Write a complete Java program that solves the following problem. You may use any
ID: 3745214 • Letter: W
Question
Write a complete Java program that solves the following problem. You may use any IDE to develop the program, but Dr. Java is recommended. Turn in the .java file into the Assignment box. (Not the .java- or .class file) Your program will prompt the user to enter a number of minutes (they may use a decimal point!) Your program will read the number of minutes and convert them to the equivalent number of seconds and hours. (There are 60 seconds in a minute and 60 minutes in an hour). Then print the number of seconds and hours back out to the user in a readable fashion.Explanation / Answer
import java.util.Scanner; public class ConvertMinutes { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Enter number of minutes: "); int minutes = in.nextInt(); int seconds = minutes * 60; double hours = minutes / 60.0; System.out.println(minutes + " minutes is " + seconds + " seconds."); System.out.println(minutes + " minutes is " + hours + " hours."); } }
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.