Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

5.14 please! ssignmenBig Java Early Obje Downlcac Bg 8ig JvaBig Java, Binde daci

ID: 3705072 • Letter: 5

Question

5.14 please!

ssignmenBig Java Early Obje Downlcac Bg 8ig JvaBig Java, Binde dacity Big Java Early ObjectsParts ratio math(PTCE B MI Java Book Why ls Communicatio E5.13 Add error handling to Exercise E5.12. If the user does not enter a number when e, print an error message and enc the program. E5.14 When two points in time are compared, each given as hours (in military time, ranging from Oand 23) and minutes, the following pseudocode determines which comes first. If hourlhour2 timel comes first. Else if hourl and hour2 are the same If minatel minste2 timel comes first. Else if minutel and minste2 are the same timel and time2 are the same. Else time2 comes first Else time2 comes first. Write a program that prompts the user for two points in time and prints the time that comes first, then the other time. In your program, supply a class Tine and a method public int compareloTine other) that returns -1 if the time comes before the other, O if both are the same, and 1 otherwise E5.1 15 The following algorithm yields the season (Spring, Summer, F'all, or Winter) for a given month and day If month is 1, 2, or 3, season "Winter Else if month is 4, 5, or 6, season Spring Else if month is 7, 8, or 9, season Summer" Else if month is 10, I1, or 12, season- "Fall If month is divisible by 3 and day21 If seasen is "Wister", season "Spring" ??

Explanation / Answer

Hi Dear,

Please find my implementation of Q5.14

import java.util.Scanner;

public class CompareTime

{

   public static void main(String[] args)

   {

       Scanner scan = new Scanner(System.in);

       System.out.print("Enter time1 hours:");

       int hr1 = scan.nextInt();

       System.out.print("Enter time1 minutes:");

       int mn1 = scan.nextInt();

       System.out.print("Enter time2 hours:");

       int hr2 = scan.nextInt();

       System.out.print("Enter time2 minutes:");

       int mn2 = scan.nextInt();

       if(hr1<hr2)

       {

           System.out.println("time1 comes first");

           return;

       }

       else if(hr1==hr2)

       {

           if(mn1<mn2)

           {

               System.out.println("time1 comes first");

               return;

           }

           else if(mn1==mn2)

           {

               System.out.println("both are same");

               return;

           }

       }

       else

       {

           System.out.println("time2 comes first");

           return;

       }

   }

}

Please DONT forgot to rate my answer. We are working hard for you Guys!!

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote