Question: Lab Exercise 4. Now modify Lab Exercise 3 to ask for the user's birth year and calculate their age. Below is the code. import java.util.Scanner;

Lab Exercise 4. Now modify Lab Exercise 3 to ask
Lab Exercise 4. Now modify Lab Exercise 3 to ask for the user's birth year and calculate their age. Below is the code. import java.util.Scanner; public class Lab { public static void main(String args) { Scanner input = new Scanner (System.in); System.out.print("Enter your first name: ~); String firstName = input.nextLine(); System.out.print("Enter your middle name: \"); String middleName = input.nextLine(); . System.out.print("Enter your last name: \"); String lastName = input.nextLine(); System.out.print("Enter your year of birth: \"); int year = input.nextInt(); int age = 2019 - year; System.out.print(firstName + ", you are " + = age + " years old.\"); Test your program and you should have an output similar to the one below. Enter your first name: Adam Enter your middle name: Joseph Enter your last.name: Smith Enter your year of birth: 1998 Adam, you are 21 years old. Next, modify the program to show how many years until your 62nd birthday. Place this output line below the line displaying your age. Test your program to make sure it works correctly

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!