Currently I was assigned an assignment that goes like this:
Write an application that reads values representing a time duration in hours, minutes and seconds and then prints the equivalent total number of seconds.
I use Eclipse to write my software and not that familiar with Java.
Here's what I got so far.
[CODE=java]public class TimeDuration {
//
// Prints a time duration from hours, minutes, and seconds and converts it into seconds
//
public static void main (String[] args)
{
double hours, minutes, sec, Xsec;
Scanner scan = new Scanner (System.in);
System.out.prin t("Enter the number of hours: ");
hours = Double();
System.out.prin t ("Enter the number of minutes: ");
minutes = Double();
System.out.prin t("Enter the number of seconds: ");
sec = Double();
Xsec = hours * minutes * sec;
System.class.pr intln ("Time Duration of :" + Xsec);
}
}[/CODE]
Can someone tell me what am I doing wrong and help correct those mistakes?
Thanks a whole lot.
Write an application that reads values representing a time duration in hours, minutes and seconds and then prints the equivalent total number of seconds.
I use Eclipse to write my software and not that familiar with Java.
Here's what I got so far.
[CODE=java]public class TimeDuration {
//
// Prints a time duration from hours, minutes, and seconds and converts it into seconds
//
public static void main (String[] args)
{
double hours, minutes, sec, Xsec;
Scanner scan = new Scanner (System.in);
System.out.prin t("Enter the number of hours: ");
hours = Double();
System.out.prin t ("Enter the number of minutes: ");
minutes = Double();
System.out.prin t("Enter the number of seconds: ");
sec = Double();
Xsec = hours * minutes * sec;
System.class.pr intln ("Time Duration of :" + Xsec);
}
}[/CODE]
Can someone tell me what am I doing wrong and help correct those mistakes?
Thanks a whole lot.
Comment