Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Start with the supplied code template, editing the top of program @author tag to include your FULL NAME. Modify the provided template, to complete the

Start with the supplied code template, editing the top of program @author tag to include your FULL NAME.
Modify the provided template, to complete the program below,
which will read in a number of minutes from the user,
and convert those minutes to hours and minutes.
NOTE: All user-defined method definitions should appear after the main() method definition.
(1)
Write a method definition to display the following program description:
Program to convert minutes to hours and minutes
There should be one blank line displayed after the program description.
Then call this method from within the main() method.
(2)
Write a method definition for a method named calcHours()
that takes the number of minutes as an input parameter,
calculates the whole hours within those minutes, and returns the result.
Then call the calcHours() method from within the main() method
and store the result returned into the wholeHours variable.
(3)
Write a method definition for a method named calcRemainingMinutes()
that takes the number of minutes as an input parameter,
calculates the minutes remaining beyond the whole hours, and returns the result.
Then call the calcRemainingMinutes() method from within the main() method
and store the result returned into the remainingMinutes variable.
(4)
Remove all the FIX ME comments from the code.
Then, add code to the main() method, that will use the values returned from the other two methods
to display the time in the format (2-digits each):
Hours and minutes: HH:MM
WARNING:
This programs output could be generated without implementing any methods, and it would still pass many of the zyLabs tests.
However, if you do not implement the methods listed in the requirements, you will lose the majority of points for this program,
because implementing methods is the purpose of this assignment.
JAVA:
import java.util.Scanner;
public class MinuteConverter {
public static void main(String[] args){
int inputMinutes =0;
int wholeHours =0;
int remainingMinutes =0;
Scanner keyboard = new Scanner(System.in);
// Fix me (1b)- Add method call to display program description
System.out.println("Enter number of minutes to convert:");
inputMinutes = keyboard.nextInt();
// Fix me (2b)- Add method call to determine whole hours and store the result
// Fix me (3b)- Add method call to determine remaining minutes and store the result
System.out.println();
// Fix me (4)- Finish below code to display returned hours and minutes in format XX:XX
System.out.printf("Hours and minutes: ");
}
// Fix me (1a)- Add code for method definition to display program description here
// Fix me (2a)- Add code for method definition of calcHours() to determine and return hours here
// Fix me (3a)- Add code for method definition of calcRemainingMinutes() to determine and return minutes here
}

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

Focus On Geodatabases In ArcGIS Pro

Authors: David W. Allen

1st Edition

1589484452, 978-1589484450

More Books

Students also viewed these Databases questions