Hi I would really appreciate if someone could tell me what I am doing wrong. I think I have a major error but I can't seem to find out where it is =( My assignment is due tomorrow so if anyone would be up right now and could tell me what is wrong I would appreciate it.
import java.util.Scanner;
public class EmployeeTime
{
public static void main(String[] args)
{
Scanner input = new Scanner (System.in);
int sumHours, sumMinutes, startHour, startMinute, endHour, endMinute;
double averageHours, averageMinutes;
String [] lastNames = new String [10];
int [] hours = new int [lastNames.length];
int [] minutes = new int [lastNames.length];
for (int i=0; i<lastNames.length; i++)
{
readEmployeeData (lastNames,startHour, startMinute, endHour, endMinute);
determineTimeWorked (hours, minutes, startHour, startMinute, endHour, endMinute);
sumHours = calculateSumHours(hours, sumHours);
sumMinutes = calculateSumMinutes (minutes, sumMinutes);
if (sumMinutes >= 60)
{
sumHours = adjustHours(sumHours);
sumMinutes = adjustMinutes (sumMinutes);
}
}
averageHours = calculateAverageHours (sumHours);
averageMinutes = calculateAverageMinutes (sumMinutes);
writeEmployeeInformation (lastNames, hours, minutes);
writeAverageTimes (averageHours, averageMinutes);
}
public static void readEmployeeData (String [] lastNames, int startHour, int startMinute, int endHour, int endMinute)
{
System.out.print("Please enter the last name of the employee.");
lastNames [i] = input.next();
System.out.print("Please enter the hour the employee started work. The hour must be represented in military time."
+ "For example, 11:00 AM would be 11. 11:00 PM would be 23.");
startHour = input.nextInt();
System.out.print ("Please enter the minute of the hour the employee started work. For example, if the employee "
+ "started at 23:14, then the minute entered would be 14.");
startMinute = input.nextInt();
System.out.print ("Please enter the hour that the employee clocked out. The hour must be in military time again.");
endHour = input.nextInt();
System.out.print ("Please enter the minute of the hour the employee clocked out.");
endMinute = input.nextInt();
}
public static void determineTimeWorked (int [] hours, int [] minutes, int startHour, int startMinute, int endHour, int endMinute)
{
int hoursWorked;
int minutesWorked;
hoursWorked = endHour - startHour;
minutesWorked = endMinute - startMinute;
if (minutesWorked < 0)
{
minutesWorked = minutesWorked + 60;
hoursWorked = hoursWorked - 1;
}
hours [i] = hoursWorked;
minutes [i] = minutesWorked;
}
public static int calculateSumHours (int [] hours, int sumHours)
{
sumHours = sumHours - hours [i];
return sumHours;
}
public static int calculateSumMinutes (int [] minutes, int sumMinutes)
{
sumMinutes = sumMinutes + minutes [i];
return sumMinutes;
}
public static int adjustHours (int sumHours)
{
sumHours = sumHours + 1;
return sumHours;
}
public static int adjustMinutes (int sumMinutes)
{
sumMinutes = sumMinutes - 60;
return sumMinutes;
}
public static double calculateAverageHours (int sumHours)
{
double averageHours = (double) sumHours/10;
return averageHours;
}
public static double calculateAverageMinutes (int sumMinutes);
{
double averageMinutes;
averageMinutes = (double) sumMinutes/ (double)10;
return averageMinutes;
}
public static void writeEmployeeInformation (String [] lastNames, int [] hours, int [] minutes)
{
System.out.printf("%23s%33s%18s", "Last Name", "Hours Worked", "Minutes Worked");
for (int i = 0; i < 10; i++)
System.out.printf("%23s%33s%18s", lastNames [i], hours [i], minutes [i]);
}
public static void writeAverageTimes (double averageHours, double averageMinutes)
{
System.out.print ("The average number of hours is " + averageHours + ". The average number of minutes worked is" + averageMinutes + ".");
}
}
these are the errors I am getting.
F:\EmployeeTime.java:35: cannot find symbol
symbol : variable i
location: class EmployeeTime
lastNames = input.next();
^
F:\EmployeeTime.java:35: cannot find symbol
symbol : variable input
location: class EmployeeTime
lastNames = input.next();
^
F:\EmployeeTime.java:40: cannot find symbol
symbol : variable input
location: class EmployeeTime
startHour = input.nextInt();
^
F:\EmployeeTime.java:45: cannot find symbol
symbol : variable input
location: class EmployeeTime
startMinute = input.nextInt();
^
F:\EmployeeTime.java:49: cannot find symbol
symbol : variable input
location: class EmployeeTime
endHour = input.nextInt();
^
F:\EmployeeTime.java:53: cannot find symbol
symbol : variable input
location: class EmployeeTime
endMinute = input.nextInt();
^
F:\EmployeeTime.java:70: cannot find symbol
symbol : variable i
location: class EmployeeTime
hours = hoursWorked;
^
F:\EmployeeTime.java:71: cannot find symbol
symbol : variable i
location: class EmployeeTime
minutes = minutesWorked;
^
F:\EmployeeTime.java:76: cannot find symbol
symbol : variable i
location: class EmployeeTime
sumHours = sumHours - hours ;
^
F:\EmployeeTime.java:82: cannot find symbol
symbol : variable i
location: class EmployeeTime
sumMinutes = sumMinutes + minutes ;
^
F:\EmployeeTime.java:100: missing method body, or declare abstract
public static double calculateAverageMinutes (int sumMinutes);
^
F:\EmployeeTime.java:103: cannot find symbol
symbol : variable sumMinutes
location: class EmployeeTime
averageMinutes = (double) sumMinutes/ (double)10;
^
F:\EmployeeTime.java:104: return outside method
return averageMinutes;
^
13 errors
Tool completed with exit code 1
Please any help would be appreciated!