Calculate your age in the year 2060.

Assignment Help JAVA Programming
Reference no: EM13940345

Declaring and initializing Java Variables

Calculate your age in the year 2060.

1. Declare an integer variable name newAge.

2. Declare and initialize an integer variable named currentAge. Initialize this variable with your current age.

3. Declare and initialize an integer variable named currentYear. Initialize this variable with the value of the currentYear. Use four digits for year. Use four digits for the year.

4. Compile the source code file Newage.java.

5. Execute the program. Record the output of this program.

I will be using java and jGrasp to complile and execute the program. Below is one of the file I down loaded from my book to give me some practice.
I just need help trying to figure out where I put my age and the year. Do I change any of the items below? I am taking an online course and really wish I would have taken this is class. My age to use is 43 and the year is course is 2012. I have a couple of assignments to do and if I can understand this one below I should be able to do the ones for class. Let me know if you need anything else.

// This program calculates your age in the year 2060.
// Input: None.
// Output: Your current age followed by your age in 2060.

publicclassNewAge
{
publicstaticvoid main(String args[])
{
// Declare and initialize your variables here.


newAge = currentAge + (2060 - currentYear);

System.out.println("My Current Age is " + currentAge);
System.out.println("I will be " + newAge + " in 2060.");

System.exit(0);
}
}

Reference no: EM13940345

Questions Cloud

Expected earnings per share : Which is 10%. Its expected earnings this year are $4 per share. Find the stock price, P/E ratio, and growth rate of dividends for plow back ratios of
Implementation of the crm : The implementation of the CRM is now in disarray. Identify the problems in the acquisition and implementation process that may have contributed to this state of affairs. Why did these problems arise?
What materials will use to lift these molds from the ground : What is the casting process used for the footwear and tire tread impressions outside of the warehouse? Explain in detail. What materials will you use to lift these molds from the ground? Explain.
Calculate your age in the year 2060. : Declare and initialize an integer variable named currentYear. Initialize this variable with the value of the currentYear. Use four digits for year. Use four digits for the year.
Display the data and the anova table : State the purpose of your experiment and explain why randomisation was necessary in your experiment. Write a model for the response in your experiment and carefully explain what each term in the model represents.  Display the data and the ANOVA table..
What was the variance of the returns over this period : You’ve observed the following returns on Doyscher Corporation’s stock over the past five years: –28.2 percent, 15.8 percent, 34.6 percent, 3.4 percent, and 22.4 percent. What was the arithmetic average return on the stock over this five-year period? ..
Types of non-financial-ethical and environmental issues : Discuss how the different types of non-financial, ethical and environmental issues might influence the objective of maximizing shareholders’ wealth by companies?
Calculates profits and sales prices for a furniture company : First calculate the profit, then calculate the sales price, then calculate the profit when the sale price used.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Rebalancing a binary search tree

Your task is to write a class RebalancingTree that extends the attached BST class. You should override the insert method in BST. Your overriding method should first call the method it is overriding

  A program called invoice that will prompt the user for items

write a program called invoice that will prompt the user for items on and invoice and then print the total of the invoice

  Define the determinant of a matrix

Define the determinant of a matrix a (written det(a)) recursively as follows: if a is a 1 x 1 matrix, then det(a) = x

  Write a program to read and add polynomials

Write a program to read and add polynomials - If the exponents are equal, then create a new term with that exponent and the sum of the coefficients, and advance both iterators.

  Develop a java based gui application

Develop a Java based GUI application(using swing) that allows the user to enter Charity/Fund information and display them in a JTable

  Convert the while loop in the following code segment

Convert the while loop in the following code segment to a do-while loop

  Create a java application that contains methods to display

Create a Java application that contains methods to display statistics for the numbers in an array. The main method has been written and it's attached. complete the program by writing the following methods.

  Demonstrate the use of conditional and looping structures

The application should have two classes; at least one class in addition to the application's controlling class. The source code must demonstrate the use of conditional and looping structures.

  Write a program that prompts the user to enter an integer

Using && and || write a program that prompts the user to enter an integer and determine whether it is: Evenly divisible by 5 AND 6.

  Describe the applications functionality

Create an application for Koch's Cottages, a weekend getaway resort that rents cottages and boats to use on the local lake - Add labels as suitable to describe the application's functionality. Save the file as JCottageFrame.java.

  Primary care-secondary care and tertitary care

Discuss the differences among primary care, secondary care, and tertitary care and the 6 C's of primary care

  Prompts the user to input a decimal number

Write a program that prompts the user to input a decimal number and ouputs the number rounded to the nearest integer.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd