Hi I need help with this it is printing out YEAR instead of the answer // This program calculates your age in the year 2050. // Input: None. // Output: Your current age followed by your age in 2050. public class NewAge2 { public static void main(String args[]) { int currentAge = 32; int newAge; int currentYear = 2022; // Declare a constant named YEAR and initialize it to 2050 final int YEAR = 2050; // Edit this statement so that it uses the constant named YEAR. newAge = currentAge + ( YEAR - currentYear ); System.out.println( " My Current Age is " + currentAge); // Edit this output statement so that is uses the constant named YEAR. System.out.println(" I will be " + newAge + " in + YEAR "); System.exit(0); } }
Hi I need help with this it is printing out YEAR instead of the answer
// This
// Input: None.
// Output: Your current age followed by your age in 2050.
public class NewAge2
{
public static void main(String args[])
{
int currentAge = 32;
int newAge;
int currentYear = 2022;
// Declare a constant named YEAR and initialize it to 2050
final int YEAR = 2050;
// Edit this statement so that it uses the constant named YEAR.
newAge = currentAge + ( YEAR - currentYear );
System.out.println( " My Current Age is " + currentAge);
// Edit this output statement so that is uses the constant named YEAR.
System.out.println(" I will be " + newAge + " in + YEAR ");
System.exit(0);
}
}

Step by step
Solved in 3 steps with 1 images









