1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
adoni [48]
3 years ago
8

rite a program to perform time conversion. The user will select from the following menu: Hours to minutes Days to hours Minutes

to hours Hours to days. Each choice has a separate method which is called when the user makes the selection. Please see the output below: Hours to minutes. 2. Days to hours. 3. Minutes to hours. 4. Hours to days. Enter your choice: 2 Enter the number of days: 5 There are 120 hours in 5 days.
Computers and Technology
1 answer:
Vinvika [58]3 years ago
7 0

Answer:

import java.util.Scanner;

public class TimeConversion

{

public static void main(String[] args) {

   

    Scanner input = new Scanner(System.in);

           

       System.out.print("1. Hours to minutes\n2. Days to hours\n3. Minutes to hours\n4. Hours to days\n");

       System.out.print("Enter your choice:");

       int choice = input.nextInt();

       

       switch(choice) {

           case 1:

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

               int hour = input.nextInt();

               System.out.println("There are "+ hour*60 + " minutes in " + hour + " hours");

               break;

           case 2:

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

               int day = input.nextInt();

               System.out.println("There are "+ day*24 + " hours in " + day + " days");

               break;

           case 3:

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

               int minute = input.nextInt();

               System.out.println("There are "+ minute/60 + " hours in " + minute + " minutes");

               break;

           case 4:

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

               int h = input.nextInt();

               System.out.println("There are "+ h/24 + " days in " + h + " hours");

               break;

           default:

               System.out.println("Invalid Input!");

       }

}

}

Explanation:

- Print the menu

- Ask the user to choose one of the options

- Depending on the choice, use switch-case statement to calculate and print required conversion

- Print an error message if the user enters a number that is not in the menu

You might be interested in
What do you think is the most important factor affecting the collection of digital data and what impact do you think that this f
borishaifa [10]

<u>Answer:</u>

<u>Privacy concerns.</u>

<u>Explanation:</u>

Privacy concerns have played an important role in how we collect digital data. For example, privacy activists believe that an individual has the right to know how his or her information is being used and that such an individual also has the right to withhold such information.

Such issues have affected the ability of law enforcement agencies to investigate criminal activities. For example, an individual who is accused of a crime may claim a <em>right to withhold his personal information, such as his mobile device, and thus he refuses to give out such information.</em>

4 0
3 years ago
So I'm a teen computer programmer, and I've built a couple of projects, but I'm looking for an idea to make me big money. So fel
Juliette [100K]
I hate lag and glitch and so many adds
5 0
3 years ago
Anyone else like hunter x hunter?<br> lets talk abt it uwu<br><br> good day :)
Aleks [24]

Answer:

mid

Explanation:

3 0
3 years ago
Read 2 more answers
Who is tim berners-lee
Juli2301 [7.4K]

Answer:

He is a Professorial Fellow of Computer Science at the University of Oxford and a professor at the Massachusetts Institute of Technology.

6 0
3 years ago
Read 2 more answers
3. Show the stack with all activation record instances (with all fields), when execution reaches position 1 in the following ske
Marianna [84]

Answer:

Check the explanation

Explanation:

The chain of static links is being referred to as static chain if it connects a particular activation record instances (ari) in the stack.

The chain of dynamic links is being referred to as dynamic chain if connected in the stack at a given time.

Kindly check the diagram in the attached image below.

8 0
3 years ago
Other questions:
  • The most popular input device of a computer is a(n) ____.
    6·1 answer
  • Which of the encryption standards listed offers the greatest amount of security? A. WPA2 B. WEP2 C. WPA D. WEP
    5·1 answer
  • The Warn-on-Forecast has been developed by the National Weather Service to help predict hazardous weather earlier. Which of the
    10·2 answers
  • 30 POINTS!!
    15·2 answers
  • Write a javascript program that reads three integers named start, end, and divisor from three textfields. your program must outp
    6·2 answers
  • What is an interactive site where users write about personal topics
    10·1 answer
  • Select the answer that best descibes what an opportunity cost is
    6·1 answer
  • How can one create an online professional network using Face book?
    14·1 answer
  • A ___ is an online collaborative event that may include such features as chat, slideshows, and PowerPoint presentations.
    8·1 answer
  • Write your question here (Keep it clear and simple to get the best answer)
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!