This is my code i cant get passed one part that used to work and now doesnt. i dont know what I changed
import java.util.*;
public class Assign4b{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
processEmployeePay(input, getEmployeeCnt(input));
double hours = 0.0;
int employees;
employees = getEmployeeCnt(input);
}
public static int getEmployeeCnt(Scanner input){
System.out.print("How many employees are there: ");
return result = input.nextInt();
}
public static void processEmployeePay(Scanner input, int employees){
double hours = 0.0;
double pay = 0.0;
String name = "";
double grossPay = 0.0;
String topName = "";
double topHours = 0.0;
for(int i = 1; i <= employees; i++){
System.out.print("Enter employee, hours worked, pay rate, and name seperated by a space: ");
hours = input.nextDouble();
pay = input.nextDouble();
name = input.nextLine();
grossPay = getGrossPay(hours, pay);
for (int i = 1; i <= employees; i++){
if (hours > tophours){
hours = topHours;
name = topName;
displayEmployeePay(name, grossPay, hours, pay);
}
//call method that print congratulations(hours, name)
}
}
public static double getGrossPay(double hours, double pay){
double total= 0.0;
if (hours <= 40){
total = (pay * hours);
}
if (hours > 40 && hours < 48){
total = (40 * pay) + ((hours - 40) * (pay * 1.5));
}
if (hours >= 48){
total = ((pay * 2) * hours) + (40 * pay) + ((hours - 40) * (pay * 1.5));
}
return total;
}
public static void displayEmployeePay(String name, double grossPay, double hours, double pay){
System.out.println("Employee name: \t" + name);
System.out.println(" Hours Worked: \t" + hours);
System.out.println(" Pay rate: \t" + pay);
System.out.println(" Gross Pay: \t" + grossPay);
System.out.println();
}
public static topEmployee(String topName, double topHours){
if (topHours > 56){
System.out.println("WOW!!!! What a Dynamo!" +topName+ "Worked "
+topHours+ "Hours This WEEK!");
} if else (topHours > 48){
System.out.println(+topName+ "is Such a WorkHorse! Looks Like You Worked "
+topHours+ "Hours this WEEK!");
} if else (topHours > 40){
System.out.println("Well, Good For YOU"+topName+", Who Worked "
+topHours+"Hours this WEEL!");
}
else (topHours <= 40){
System.out.println("Most hours but no one worked over 40: "+topName+"Worked "
+topHours+ "Hours this WEEK!");
}
}
}
all the billion errors
Assign4b.java:51: error: illegal start of expression
public static double getGrossPay(double hours, double pay){
^
Assign4b.java:51: error: illegal start of expression
public static double getGrossPay(double hours, double pay){
^
Assign4b.java:51: error: ';' expected
public static double getGrossPay(double hours, double pay){
^
Assign4b.java:51: error: '.class' expected
public static double getGrossPay(double hours, double pay){
^
Assign4b.java:51: error: ';' expected
public static double getGrossPay(double hours, double pay){
^
Assign4b.java:51: error: ';' expected
public static double getGrossPay(double hours, double pay){
^
Assign4b.java:64: error: illegal start of expression
public static void displayEmployeePay(String name, double grossPay, double hours, double pay){
^
Assign4b.java:64: error: illegal start of expression
public static void displayEmployeePay(String name, double grossPay, double hours, double pay){
^
Assign4b.java:64: error: ';' expected
public static void displayEmployeePay(String name, double grossPay, double hours, double pay){
^
Assign4b.java:64: error: ')' expected
public static void displayEmployeePay(String name, double grossPay, double hours, double pay){
^
Assign4b.java:64: error: illegal start of expression
public static void displayEmployeePay(String name, double grossPay, double hours, double pay){
^
Assign4b.java:64: error: ';' expected
public static void displayEmployeePay(String name, double grossPay, double hours, double pay){
^
Assign4b.java:64: error: not a statement
public static void displayEmployeePay(String name, double grossPay, double hours, double pay){
^
Assign4b.java:64: error: ';' expected
public static void displayEmployeePay(String name, double grossPay, double hours, double pay){
^
Assign4b.java:64: error: <identifier> expected
public static void displayEmployeePay(String name, double grossPay, double hours, double pay){
^
Assign4b.java:64: error: not a statement
public static void displayEmployeePay(String name, double grossPay, double hours, double pay){
^
Assign4b.java:64: error: ';' expected
public static void displayEmployeePay(String name, double grossPay, double hours, double pay){
^
Assign4b.java:71: error: illegal start of expression
public static topEmployee(String topName, double topHours){
^
Assign4b.java:71: error: illegal start of expression
public static topEmployee(String topName, double topHours){
^
Assign4b.java:71: error: ';' expected
public static topEmployee(String topName, double topHours){
^
Assign4b.java:71: error: <identifier> expected
public static topEmployee(String topName, double topHours){
^
Assign4b.java:71: error: not a statement
public static topEmployee(String topName, double topHours){
^
Assign4b.java:71: error: ';' expected
public static topEmployee(String topName, double topHours){
^
Assign4b.java:75: error: '(' expected
} if else (topHours > 48){
^
Assign4b.java:75: error: illegal start of expression
} if else (topHours > 48){
^
Assign4b.java:75: error: ')' expected
} if else (topHours > 48){
^
Assign4b.java:75: error: not a statement
} if else (topHours > 48){
^
Assign4b.java:75: error: ';' expected
} if else (topHours > 48){
^
Assign4b.java:78: error: '(' expected
} if else (topHours > 40){
^
Assign4b.java:78: error: illegal start of expression
} if else (topHours > 40){
^
Assign4b.java:78: error: ')' expected
} if else (topHours > 40){
^
Assign4b.java:78: error: not a statement
} if else (topHours > 40){
^
Assign4b.java:78: error: ';' expected
} if else (topHours > 40){
^
Assign4b.java:82: error: 'else' without 'if'
else (topHours <= 40){
^
Assign4b.java:82: error: not a statement
else (topHours <= 40){
^
Assign4b.java:82: error: ';' expected
else (topHours <= 40){
^
Assign4b.java:87: error: reached end of file while parsing
}