Question: Please draw a flowchart Challenge: The Time calculator Coding challenge - There are 60 seconds in a minute. If the number of seconds entered by

Please draw a flowchart

Challenge: The Time calculator Coding challenge

- There are 60 seconds in a minute. If the number of seconds entered by the user is greater than or equal to 60, the program should display the number of minutes in that many seconds.

- There are 3600 seconds in an hour. If the number of seconds entered by the user is greater than or equal to 3,600, the program should display the number of hours in that many seconds.

- There are 86,400 seconds in a day. If the number of seconds entered by the user is greater than or equal to 86,400, the program should display the number of hours in that many seconds.

Here's my code:

import java.util.Scanner;

public class TimeCalculator {

public static void main(String[] args) {

// TODO Auto-generated method stub

Scanner sc = new Scanner(System.in);

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

int sec = sc.nextInt();

if(sec>=60&& sec

System.out.println(sec/60 + " minutes and " + sec%60 + " sec");

else if (sec>=3600&& sec

int minutes = sec/60;

int hours = minutes/60;

System.out.println(hours + " hours and " + minutes%60 + " minutes " + sec%60 + " seconds");

}else if(sec

System.out.println(sec +" seconds");

else{

int minutes = sec/60;

int hours = minutes/60;

int day = hours/24;

System.out.println(day + " day and " + hours%24 + " hours and " + minutes%60 + " minutes " + sec%60 + " seconds");

}

}

} ========================= See Output Please draw a flowchart Challenge: The Time calculator Coding challenge - There

60&& sec 3600) 14 System. out printinC sec/60 minutes and sec%60 sec"); else if Csec 36008& SeCK 8640001 int minutes sec/60; int hours minutes /60 18 System. hours hours and minutes minutes Sec %60 %6 19 Helse if Csec

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 Databases Questions!