Explore BrainMass

Explore BrainMass

    A java program that declares and initializes variables.

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Need help with declaring and initializing java variables. I am trying to compile and execute a program. I have downloaded the file and attached it.

    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.

    Please refer to attachment for full questions.

    © BrainMass Inc. brainmass.com October 10, 2019, 4:56 am ad1c9bdddf


    Solution Preview

    Dear student,

    Please find the solution attached.

    Kavita Narang

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

    Solution Summary

    The solution contains the complete program. The code is completely commented and follows all the guidelines for easier and faster understanding of the Java basics. The adjusted Java program is provided in a word document and a jpeg of the output is given.