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

  Write java program which will permit user to make selection

Write the Java Program which will permit the user to make selection. You will present user with two options to perform, then you will perform action selected by user.

  Implement the nested loops

The user has also already entered a mystery number they want the following series to calculate based upon their current numbers (also relatively logical in size).

  Process of buying a soda from a soda machine

Please write a Java Program those steps through the process of buying a soda from a Soda Machine.  You must interact with the consumer. Each Soda is one dollar.

  Write a program computehalf.java

Write a program ComputeHalf.Java that asks the user to a string. Write a method secondHalf that returns the second half of the input string.

  The java code conventions

The database must be able to retrieve client information and display it on the screen for a specific telephone number match. The program must be well commented and documented using javadoc. The program must conform to the Java Code Conventions

  Write a program that reads a series of test scores

Write a program that reads a series of test scores from a recent test (integers in the range 0 to 100) until a sentinel value is read. A sentinel value is the value used to determine when to stop. The program then prints the following statistics f..

  How can an applet get information about the url

How can an applet get information about the URL it was called from? What is an applet? What API changes are there for applets with JDK 1.4?

  Video store application

Prepare an object-oriented program in Java for a video store application with the subsequent

  In this project you need to write a program called gf2java

in this project you need to write a program called gf2.java to implement the finite field gfpnwhere p is a prime number

  One-dimensional array to store grades

Use three arrays: a one-dimensional array to store the student names, a (parallel) twodimensional array to store the test score, and a parallel one-dimensional array to store grades.

  Program produces 1000 integer ranging

Then your program produces 1000 integer ranging from 1to 10000 in the array and then sort them in ascending order and then print the result into data.txt file. (You may list integers separated by space or new line)

  It inherits the functionality of super class

It inherits the functionality of super class Package and contains an additional data member representing an additional fee per ounce charged for overnight-delivery service.

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