Hi! I'm trying to have the user input the number of hours, minutes, and seconds, and it output what that is in seconds.
WHY WONT IT COMPILE... It says i have an illegal start of expresion at private static double hour(). help?
import java.util.Scanner;
public class timeTest
{
public static void main (String[] args)
{
System.out.println("So I downloaded BlueJ at home!");
System.out.println("This code is 2.6 on page 120.");
Scanner scan = new Scanner(System.in);
{
private static double hour()
{
double hour = 0;
Scanner hourScan = new Scanner(System.in);
System.out.println("Enter the number of hours: ");
double x = hourScan.nextDouble();
hourSec = x*3600;
return hourSec;
}
private static double minute()
{
double minute = 0;
Scanner minScan = new Scanner(System.in);
System.out.println("Enter the number of minutes: ");
double y = minScan.nextDouble();
minSec = y*60;
return minuteSec;
}
private static double second()
{
double second = 0;
Scanner secScan = new Scanner(System.in);
System.out.println("Enter the number of seconds: ");
double z = secScan.nextDouble();
Sec = z*1;
return Sec;
}
}
System.out.println(hourSec+minuteSec+Sec);
}
}