Write a menu driven program to display the following menu:
Conversion Table
===========================
1. Milliseconds to Seconds
2. Milliseconds to Minutes
3. Seconds to Milliseconds
4. Seconds to Minutes
5. Minutes to Milliseconds
6. Minutes to Seconds
===========================
For an incorrect choice, display an appropriate error message.
( Hint: 1 second = 1000 milliseconds )
Answers
Answered by
2
Answer:
import java.util.Scanner;
public class Seconds
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
int n,s=0;
double t;
System.out.println("Menu List:");
System.out.println("1. Miliseconds to Seconds");
System.out.println("2. Milliseconds to Minutes");
System.out.println("3. Seconds to Milliseconds");
System.out.println("4. Seconds to Minutes");
System.out.println("5. Minutes to Milliseconds");
System.out.println("6. Minutes to Seconds");
System.out.println("Enter your choice");
n=in.nextInt();
switch (n)
{
case 1:
System.out.println("Enter the value of milliseconds");
s=in.nextInt();
t=s/1000.0;
System.out.println("Answer="+t);
Similar questions