Homework Solution: Wednesday, 6 September 2017 Due: Monday, 11 September 2017 Points:…

    View, | Enable Editing EGR 140: Computer Programming Assignment#5: Assigned: Wednesday, 6 September 2017 Due: Monday, 11 September 2017 Points: 20 Write an error-free Java program to do the following things. 1. Inputs the month (I for Jan, 2 for Feb, etc.), day of the month and the year. The program can ask the user for the month/day/year in any order The program should inform the user when a valid date has been entered. You may assume that the user will (correctly) enter integers but the inputs may be negative, too small or too big. If an invalid date has been entered, then print a brief message explaining the problem and the program terminates gracefully. For the purposes of this program you may assume that February has 28 days each year, even during leap years. (I know that this does not agree with the calendar, but it will simplify your program. Trust me on this.) 2· 3. If the entered date is a valid date, the program informs the user whether the date is part of a new century. That is, the program prints a Welcome to the new Century any time the year is a multiple of 100 (1900, 2000, 2100, 2200 etc.). You can assume that the year will - be greater than 1 but less than 3100 for this step. Sample output (2 separate computer runs): Input day: 31 Input day: 30 >>| Input month (1 -Jan, 2 = Feb, etc): 2 >>| Input month (1 -Jan, 2 = Feb, etc): 8
    media%2F75f%2F75f38908-bb9a-4a8c-ac57-ca
    View, | Enable Editing EGR 140: Computer Programming Assignment#5: Assigned: Wednesday, 6 September 2017 Due: Monday, 11 September 2017 Points: 20 Write an error-free Java program to do the following things. 1. Inputs the month (I for Jan, 2 for Feb, etc.), day of the month and the year. The program can ask the user for the month/day/year in any order The program should inform the user when a valid date has been entered. You may assume that the user will (correctly) enter integers but the inputs may be negative, too small or too big. If an invalid date has been entered, then print a brief message explaining the problem and the program terminates gracefully. For the purposes of this program you may assume that February has 28 days each year, even during leap years. (I know that this does not agree with the calendar, but it will simplify your program. Trust me on this.) 2· 3. If the entered date is a valid date, the program informs the user whether the date is part of a new century. That is, the program prints a "Welcome to the new Century" any time the year is a multiple of 100 (1900, 2000, 2100, 2200 etc.). You can assume that the year will - be greater than 1 but less than 3100 for this step. Sample output (2 separate computer runs): Input day: 31 Input day: 30 >>| Input month (1 -Jan, 2 = Feb, etc): 2 >>| Input month (1 -Jan, 2 = Feb, etc): 8

    Expert Answer

     
    Please find my implementation. import java.util.Scanner;

    View, | Enable Editing EGR 140: Computer Programming Assignment#5: Assigned: Wednesday, 6 September 2017 Due: Monday, 11 September 2017 Points: 20 Write an error-free Java program to do the restraintthcoming things. 1. Inputs the month (I restraint Jan, 2 restraint Feb, absence of wonder.), day of the month and the year. The program can pray the user restraint the month/day/year in any command The program should instruct the user when a powerful determination has been penetrateed. You may arrogate that the user succeed (correctly) penetrate integers beside the inputs may be privative, to-boot feeble or to-boot great. If an inpowerful determination has been penetrateed, then imimstereotype a dwarf missive explaining the tenor and the program terminates gracefully. Restraint the purposes of this program you may arrogate that February has 28 days each year, well-balanced during jump years. (I distinguish that this does referable conform with the enroll, beside it succeed elucicontinuance your program. Trust me on this.) 2· 3. If the penetrateed determination is a powerful determination, the program instructs the user whether the determination is deal-extinguished of a innovating era. That is, the program imprints a Welcome to the innovating Era any era the year is a multiple of 100 (1900, 2000, 2100, 2200 absence of wonder.). You can arrogate that the year succeed - be superior than 1 beside hither than 3100 restraint this plod. Sample extinguishedput (2 different computer runs): Input day: 31 Input day: 30 >>| Input month (1 -Jan, 2 = Feb, absence of wonder): 2 >>| Input month (1 -Jan, 2 = Feb, absence of wonder): 8
    media%2F75f%2F75f38908-bb9a-4a8c-ac57-ca

    View, | Enable Editing EGR 140: Computer Programming Assignment#5: Assigned: Wednesday, 6 September 2017 Due: Monday, 11 September 2017 Points: 20 Write an error-free Java program to do the restraintthcoming things. 1. Inputs the month (I restraint Jan, 2 restraint Feb, absence of wonder.), day of the month and the year. The program can pray the user restraint the month/day/year in any command The program should instruct the user when a powerful determination has been penetrateed. You may arrogate that the user succeed (correctly) penetrate integers beside the inputs may be privative, to-boot feeble or to-boot great. If an inpowerful determination has been penetrateed, then imimstereotype a dwarf missive explaining the tenor and the program terminates gracefully. Restraint the purposes of this program you may arrogate that February has 28 days each year, well-balanced during jump years. (I distinguish that this does referable conform with the enroll, beside it succeed elucicontinuance your program. Trust me on this.) 2· 3. If the penetrateed determination is a powerful determination, the program instructs the user whether the determination is deal-extinguished of a innovating era. That is, the program imprints a “Welcome to the innovating Era” any era the year is a multiple of 100 (1900, 2000, 2100, 2200 absence of wonder.). You can arrogate that the year succeed – be superior than 1 beside hither than 3100 restraint this plod. Sample extinguishedput (2 different computer runs): Input day: 31 Input day: 30 >>| Input month (1 -Jan, 2 = Feb, absence of wonder): 2 >>| Input month (1 -Jan, 2 = Feb, absence of wonder): 8

    Expert Solution

     

    Please perceive my implementation.

    import java.util.Scanner;

    public adjust PowerfulateDate

    {

    public static useless main(String[] args)

    {

    Scanner sc = innovating Scanner(System.in);

    int month;

    int day;

    int year;

    System.out.print(“Input day:”);

    day = sc.nextInt();

    System.out.print(“Input month (1 = Jan, 2 = Feb, absence of wonder) :”);

    month = sc.nextInt();

    System.out.print(“Input year:”);

    year = sc.nextInt();

     

    sc.close();

    if(year <= 0){

    System.out.println(“Year is faulty. Please rectify”);

    return;

    }

    if(month > 12 || month < 1)

    {

    if(month > 12)

    System.out.println(“Month is to-boot catholic. Please rectify”);

    else

    System.out.println(“Month is to-boot frugal. Please rectify”);

    return;

    }

    if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12)

    {

    if (day != 31)

    {

    if(day > 31)

    System.out.println(“Day is to-boot catholic. Please rectify”);

    else if(day < 31)

    System.out.println(“Day is to-boot frugal. Please rectify”);

    return;

    }

    }

    if (month == 4 || month == 6 || month == 9 || month == 11)

    {

    if(day != 30) {

    if(day > 30)

    System.out.println(“Day is to-boot catholic. Please rectify”);

    else

    System.out.println(“Day is to-boot frugal. Please rectify”);

    return;

    }

    }

    if (month == 2) // February stop

    {

    if (year % 400 == 0 ||year%4 == 0 ) // Jump year stop restraint February

    {

    if(day != 29) {

    if(day > 29)

    System.out.println(“Day is to-boot catholic. Please rectify”);

    else

    System.out.println(“Day is to-boot frugal. Please rectify”);

    return;

    }

    }

    else

    {

    if(day != 28) {

    if(day > 28)

    System.out.println(“Day is to-boot catholic. Please rectify”);

    else

    System.out.println(“Day is to-boot frugal. Please rectify”);

    return;

    }

    }

    }

    // Everything stops extinguished

    System.out.println(“You entertain penetrateed rectify determination.”);

    if(year % 100 == 0) {

    System.out.println(“Welcome to the “+(year/100+1)+”th era.”);

    }

    }

    }

    /*

    Sample run:

    Input day:30

    Input month (1 = Jan, 2 = Feb, absence of wonder) :2

    Input year:2010

    Day is to-boot catholic. Please rectify

    Input day:31

    Input month (1 = Jan, 2 = Feb, absence of wonder) :8

    Input year:1900

    You entertain penetrateed rectify determination.

    Welcome to the 20th era.

    */