Okay I have managed to finish everything. However, my output for average minutes and average hours is wrong for some reason. I have looked over my code multiple times and I cannot figure out what the problem is. I would appreciate any help.

Here is my code. Can you tell if anything is wrong in the logic or the Calculate average methods?

/* This program prompts the user to enter data for 10 employees only. The program will
prompt the user to enter the last name of the employee, the hour they started (in military time),
the minute they started, the hour (in military) that they ended, and the minute they ended work. The
program will output the employee's last name, the hours they worked, and the minutes they worked that
day in a nicely formatted column. We are assuming everything has been validated and this program works
only for the day assigned. No employee works past to the next day.*/

import java.util.Scanner;
public class EmployeeTime
public static void main(String[] args)

int sumHours =0, sumMinutes=0;
double averageHours, averageMinutes;
String [] lastNames = new String [10];
int [] hours = new int [lastNames.length];
int [] minutes = new int [lastNames.length];
int [] startHour = new int [lastNames.length];
int [] startMinute = new int [lastNames.length];
int [] endHour = new int [lastNames.length];
int [] endMinute = new int [lastNames.length];

for (int i=0; i<lastNames.length; i++)
readEmployeeData (lastNames, startHour, startMinute, endHour, endMinute, i);
determineTimeWorked (hours, minutes, startHour, startMinute, endHour, endMinute,i);
sumHours = calculateSumHours(hours, sumHours, i);
sumMinutes = calculateSumMinutes (minutes,sumHours,i);
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, int i)

//We will read each input into its corresponding array.


Scanner input = new Scanner (System.in);

System.out.println("Please enter the last name of the next employee.  ");

lastNames  = input.next();

System.out.println("Please enter the hour the employee started work. The hour must be represented"
+ "\n" + " in military time For example, 11:00 AM would be 11. 11:00 PM would be 23.  ");

startHour  = input.nextInt();

System.out.println ("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.println ("Please enter the hour that the employee clocked out. The hour must be in" +
"\n military time again.  ");

endHour  = input.nextInt();

System.out.println ("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 i)

/*This method will determine the the number of hours and minutes each employee worked.
If the minutes are less than 0, then the method will adjust the minutes and times*/

int hoursWorked;

int minutesWorked;

hoursWorked = endHour  - startHour ;
minutesWorked = endMinute  - startMinute ;

if (minutesWorked < 0)
minutesWorked = minutesWorked + 60;
hoursWorked = hoursWorked - 1;
hours  = hoursWorked;
minutes  = minutesWorked;

public static int calculateSumHours (int [] hours, int sumHours, int i)

// This method adds the hours of all employees together for later use.

int sumOfHours;
sumOfHours = sumHours + hours ;
return sumOfHours;

public static int calculateSumMinutes (int [] minutes, int sumMinutes, int i)

//This methods adds the minutes of all employees together for later use

int sumOfMinutes;
sumOfMinutes = sumMinutes + minutes ;
return sumOfMinutes;
public static int adjustHours (int sumHours)

//This method adjusts the hours if the sumMinutes variable is more than 60.

sumHours = sumHours + 1;
return sumHours;

public static int adjustMinutes (int sumMinutes)

//This method adjusts the minutes if the sumMinutes variable is more than 60.

sumMinutes = sumMinutes - 60;
return sumMinutes;
public static double calculateAverageHours (int sumHours)

//This method will calculate the average hours of all employees.

double averageHours = (double) sumHours/(double) 10;
return averageHours;
public static double calculateAverageMinutes (int sumMinutes)

//This method calculates the average minutes of all employees.

double averageMinutes;
averageMinutes = (double) sumMinutes/ (double) 10;
return averageMinutes;
public static void writeEmployeeInformation (String [] lastNames, int [] hours, int [] minutes)

/*This method outputs the necessary information for the employee under nicely formatted headings
and columns. */

System.out.printf("%15s%16s%18s\n", "Last Name", "Hours Worked", "Minutes Worked");
for (int i = 0; i < 10; i++)
System.out.printf("%15s%11s%13s\n", lastNames , hours , minutes );
public static void writeAverageTimes (double averageHours, double averageMinutes)

//This method outputs the average number of hours and minutes all the employees worked.

System.out.println ("The average number of hours is " + averageHours + ".");
System.out.println ("The average number of minutes worked is" + averageMinutes + ".");

Use code tags. And you should be able to identify the problem area by debugging. Use print statements to determine the state of your variables at important points in your code.