Computer Science, asked by CuteSiddhi, 1 year ago

Write an application that reads values representing a time duration in hrs , min, sec and then print the equivalent total no.of sec ( java programming) eg- 1hr 28 mins and 42 sec is equivalent to 5322sec


CuteSiddhi: please anyone ans its urgent

Answers

Answered by anirbanroy
2
import java.io.*;
class TimeConversion
{
public static void main()throws IOException
{
InputStreamReader rd=new InputStreamReader(System.in);
BufferedReader sc=new BufferedReader(rd);
int h,m,s,n;
System.out.println("How many Hours?");
h=Integer.parseInt(sc.readLine());
System.out.println("How many Minutes?");
m=Integer.parseInt(sc.readLine());
System.out.println("How many Seconds?");
s=Integer.parseInt(sc.readLine());
n=(h*3600)+(m*60)+s;
System.out.println("That is equivalent to "+n+" seconds.");
}
}
Similar questions