Question

Create a Java program the does the following: I need  a version of the program below that...

Create a Java program the does the following:

I need  a version of the program below that uses the System.out.printf for output.

The value for your name should be coded using proper casing for names. I.E "John Doe". However, it must display in uppercase using a format specifier.

  1. Create a String variable and assign your name to it.
  2. Create an integer variable for the year 2030 and assign 2030 to it.
  3. Create an integer variable named currentYear and assign the current year to it. (i.e 20##);
  4. Create an integer for your age and assign your current age to it.
  5. Create an integer to store the result of   age + (year2030 - currentYear) where year2030 is the variable referenced in step 2.
  6. Display "<student> will be age <age> in the year <year2030>" where <> are your variable values.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

public class SamEx {
   public static void main(String[] args) {
       String name="Uday";
       int year=2030;
       int currentYear=2019;
       int age=25;
       int res=age+(year-currentYear);
       System.out.println(name+" will be age "+res+" in the year "+year);
   }
}

Note : Please comment below if you have concerns. I am here to help you

If you like my answer please rate and help me it is very Imp for me

Add a comment
Know the answer?
Add Answer to:
Create a Java program the does the following: I need  a version of the program below that...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT