Payroll part 3 errors help
Code:
// Program: Payroll Program Part 2
// File: ProgramPayroll.java
// Summary: Payroll Calculator that interacts with user to calculate the employee's payroll with the hourly rate and hours worked by the employee.
// Author: Charlene Arreche
// Date: November 7,2009.
import java.util.Scanner;
import java.text.NumberFormat;
class EmployeeInfo {
private String employee = "";// Declares string variable Employee
private double rate, hours, salary = 0;// Declares double variables Rate, Hours and Salary
public EmployeeInfo(){}// Creates constructor (Empty constructor)
public EmployeeInfo(String employee,double rate, double hours){//Constructor with parameters
setEmployee(employee);
setRate(rate);
setHours(hours);
}
public void setEmployee(String employee){
this.employee = employee;
}
public String getEmployee(){
return this.employee;
}
public void setRate(double rate){
this.rate = rate;
}
public double getRate(){
return rate;
}
public void setHours(double hours){
this.hours = hours;
}
public double getHours (){
return hours;
}
}// Ends class
Code:
// Program: Payroll Program Part 2
// File: Payroll.java
// Summary: Payroll Calculator that interacts with user to calculate the employee's payroll with the hourly rate and hours worked by the employee.
// Author: Charlene Arreche
// Date: October 30,2009.
import java.util.Scanner;//This line allows the user to interact with the application.
public class EmployeeProgram{//Payroll class
public static void main(String args[]){
Scanner userInput = new Scanner(System.in);//This line tells the application expects input from the user.
System.out.println("Welcome to the Payroll Calculator Application.");//This line welcomes the user to the application.
System.out.println("Please enter the employee's name here");//This line prompts the user to input the employee's name.
System.out.println("To quit enter stop"); //This line prompts the user to enter the word stop to quit the application
EmployeeInfo pro = new EmployeeInfo();// Creates object pro
pro.setEmployee(userInput.nextLine());//This line tells the program to expect Employee input from user.
while (!pro.getEmployee().toUpperCase().equals("STOP"))//loop while employee not = STOP
{
System.out.println("Please enter the hourly rate");// This line prompts the user to input the hourly rate for that employee.
double rate = userInput.nextDouble();
if (rate < 0){
System.out.println("Please enter a positive amount.");}
else{
System.out.println("Please enter how many hours " + employee + " worked this week");}// This line prompts the user to input the hours worked by that employee.
double hours = userInput.nextDouble();// This line tells the program to expect Hours input from the user.
if (hours <0){
System.out.println("Please enter a positive amount.");
}
else{
double salary = rate * hours;
}
private static void Exit(){
System.out.println("Thank you for using the Payroll Application. Good bye!");
System.exit (0);}
public void displayResult(){
System.out.println("The Salary for " + getEmployee()+ "is " + salary +".");
}
userInput.close();
}//End class
When I run it gives me these errors:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
employee cannot be resolved
Syntax error, insert "}" to complete Block
Syntax error, insert "}" to complete Block
at EmployeeProgram.main(EmployeeProgram.java:28)
Please help!