Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

-----------------------------------------------------------------------------

THIS IS THE PSEUDOCODE:

import java.util.Scanner; public class TimeShell { //declare all your constants public static final int SEC_PER_MINUTE = 60; public static void main(String[] args) { Scanner kb = new Scanner(System.in); start(kb); } /* call the method description prompt the user for the name and the number of the times that they want to use this program get the hours, minutes, seconds call the method hoursToSec call the method minToSec calculate the total seconds output the total seconds call the method minSec to calulate the minutes and sec call the method hourMinSec*/ public static void start(Scanner kb) { minSec(167); } /*This method get the totlal number of the seconds and finds the number of the minutes and sec and outputs the result*/ public static void minSec(int totalSeconds) { int min = totalSeconds / SEC_PER_MINUTE; int sec = totalSeconds % SEC_PER_MINUTE; //output the result System.out.println(totalSeconds + " seconds is " + min +" minutes and " + sec + " seconds"); } /*This method get the total number of the seconds and calculates the number of hours, minutes and second, then outputs the result*/ public static void hourMinSec(int totalSeconds) { } /*calulates the number of the seconds in the given hours and returns the value*/ public static int hourToSec(int hours) { return 0; } /*This method calculates the number of the seconds in the given number of minutes*/ public static int minToSec(int min) { return 0; } /*outputs the description of the program*/ public static void description() { } } 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Options Trading QuickStart Guide The Simplified Beginners Guide To Options Trading

Authors: Clydebank Finance

2nd Edition

1945051051, 978-1945051050

Students also viewed these Databases questions