Declaring and Initializing Java Constants
In this lab, you declare and initialize constants in a Java program provided with the data files for this book. The program, which is saved in a file named NewAge2 j ava, calculates your age in the year 2050.
1. Open the source code file named NewAge2.java using Notepad or the text editor of your choice.
2. Declare a constant named YEAR, and initialize YEAR with the value. 2050.
3. Edit the following statement so it uses the constant named YEAR:
newAge = currentAge + (2050 - currentYear);
4. Edit the following statement so it uses the constant named YEAR:
System. out .pri ntl n ("I will be" + newAge + "in 2050 . ") ;
5. Save this source code file in a directory of your choice, and then make that directory your working directory.
6. Compile the source code file NewAge2.java.
7. Execute the program. Record the output of this program. _____________________________________________________________________________________ _____________________________________________________________________________________
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.