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]
2 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]2 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
Hy <br> Anyone from kerala?
Lera25 [3.4K]

Answer:

i dont know

Explanation:

7 0
2 years ago
Read 2 more answers
The auto recover function in a word is available to especially if you experience powerful failure explain what happens to your d
Komok [63]

Answer:

When the document is not saved before the application is closed, The word application assumes that the file is not important, so does not save a recovery file, but to recover the file open the application and go to the recently opened file, do not edit the file, go to the bottom of the document and click on recovery or use the CTRL-Z shortcut key.

Explanation:

Microsoft word is a word processing application used to make and edit word documents. The recovery option in the word application is an essential tool in Word that prevents a permanent loss of documents in production and can be used to retrieve saved and unsaved documents.

7 0
2 years ago
which of the following scenarios is a circumstance in which it would be ethical to practice confidentiality?
Citrus2011 [14]
Hi. I am not sure if there should be choices included in your post. If there is none, I'll just share a circumstance to where a professional practices confidentiality as an answer. 

Counselors or psychotherapists can only divulge information about their clients or patients if there is a court order or if the client will harm him/her self or plan to harm others. Primarily, they are to respect the client's choice to keep the sessions with full confidentiality. 
4 0
3 years ago
Microsoft Advertising includes robust research and reporting tools to help you identify potential areas for campaign improvement
stich3 [128]

Answer:

C. Optimization​

Explanation:

Optimization entails improving your ads campaign making use of the available tools.

Optimization mostly makes ad to target the right audience and engage the right people.

6 0
3 years ago
Write a program that prompts the user to enter a password and displays "valid password"
natali 33 [55]

Explanation:

please be more specific

6 0
3 years ago
Other questions:
  • Which activity uses a feature of a word processor?
    7·2 answers
  • John would like to move from the city into the suburbs and has been saving up a large down payment for a home. which is the most
    9·1 answer
  • Write Java program to allow the user to input the amount of deposit, yearly interest rate (percentage), and income tax(percentag
    9·1 answer
  • Show the printout of the following code.
    14·1 answer
  • Betrand Meyer developed the ______ programming language which is not type-safe because it violates the law of contravariance.
    9·1 answer
  • What does a wholesaler do?
    12·1 answer
  • cout &lt;&lt; "Part 1" &lt;&lt; endl; // Part 1 // Enter the statement to print the numbers in index 4 and index 9 // put a spac
    11·1 answer
  • I am not a living being, I am a cylindrical shape that has three to eight sides. I never die. I can build anything again. What i
    5·1 answer
  • WIN
    9·2 answers
  • ¿Qué aspectos de impacto medioambiental e impacto social tienen relación con la poca disminución de los residuos? Es para hoy.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!