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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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