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

IN JAVA LANGUAGE PLEASE Write a complete program that generates the exact follow

ID: 3888040 • Letter: I

Question

IN JAVA LANGUAGE PLEASE

Write a complete program that generates the exact following output. In this program you need to prompt the user the number of hours, minutes and seconds and then output the equivalent amount in minutes and seconds and hours. Please refer to the shell provided for you for more details.

Requirements:

Must provide the exact same output word by word

Main method can only have two lines of code.

Proper indentation

Proper naming

Comments

Logic

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%
This program converts hours, minutes, second to second and display in on the screen. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%

How many times do you want to use the app? 2 What is your name? Alex Patten
Hi Alex Patten Lets start!!

Enter the number of the hours:3
Enter the number of the minutes: 5
Enter the number of the seconds: 360
3 Hours, 5 Minutes, and 360 Seconds is :

11460 seconds
191 Minutes 0 Seconds
3 Hours and 11 Minutes and 0 Seconds

What is your name? Mary Lee Hi Mary Lee Lets start!!

Enter the number of the hours:5
Enter the number of the minutes: 128
Enter the number of the seconds: 728
5 Hours, 128 Minutes, and 728 Seconds is :

26408 seconds
440 Minutes 8 Seconds
7 Hours and 20 Minutes and 8 Seconds

Explanation / Answer

TimeCheck.java

import java.util.Scanner;

public class TimeCheck {

public static void main(String[] args) {

Scanner scan = new Scanner(System.in);

System.out.print("How many times do you want to use the app? ");

int n = scan.nextInt();

for(int i=0;i<n;i++) {

scan.nextLine();

System.out.print("What is your name?");

String name = scan.nextLine();

System.out.println("Hi "+name+" Lets start!!");

System.out.print("Enter the number of the hours: ");

int hours = scan.nextInt();

System.out.print("Enter the number of the minutes: ");

int minutes = scan.nextInt();

System.out.print("Enter the number of the seconds: ");

int seconds = scan.nextInt();

System.out.println(hours+" Hours, "+minutes+" Minutes, "+seconds+" Seconds is: ");

int totalSeconds = seconds+hours*60*60+minutes*60;

int totalMinutes = totalSeconds / 60;

int remainingSeconds = totalSeconds % 60;

int totalHours = totalSeconds / (60 * 60);

int remaningHoursMinutes =totalMinutes % 60;

int remaningHoursSeconds =totalSeconds % 60;

System.out.println(totalSeconds+" Seconds");

System.out.println(totalMinutes+" Minutes "+remainingSeconds+" Seconds ");

System.out.println(totalHours+" Hours and "+remaningHoursMinutes+" Minutes "+remaningHoursSeconds+" and Seconds ");

}

}

}

Output:

How many times do you want to use the app? 2
What is your name?Alex Patten
Hi Alex Patten Lets start!!
Enter the number of the hours: 3
Enter the number of the minutes: 5
Enter the number of the seconds: 360
3 Hours, 5 Minutes, 360 Seconds is:
11460 Seconds
191 Minutes 0 Seconds
3 Hours and 11 Minutes 0 and Seconds
What is your name?Mary Lee
Hi Mary Lee Lets start!!
Enter the number of the hours: 5
Enter the number of the minutes: 128
Enter the number of the seconds: 728
5 Hours, 128 Minutes, 728 Seconds is:
26408 Seconds
440 Minutes 8 Seconds
7 Hours and 20 Minutes 8 and Seconds