I'm getting error messages when I run my program. The problem is as follows:

Design a Payroll class that has fields for an employee's name, ID number, hourly pay rate, and number of hours worked. Write the appropriate accessor and mutator methods and a constructor that accepts the employee's name and ID number as arguments. The class should also have a method that returns the employee's gross pay, which is calculated as the number of hours worked multiplied by the hourly rate. Write a program that demonstrates the class by creating a Payroll object, then asking the user to enter the data for an employee. The program should display the amount of gross pay earned.

My code is as follows. I have a Payroll class and Payroll demo files:

// Payroll3.java
// This is a class called Payroll3 that holds different data for an employee.
// Chapter 6, #3.

   public class Payroll3
      private String EmployeeName; 		// Name
      private int ID; 					// Address
      private double HourlyPay; 			  			
      private double HoursWorked;									
      private double WeeklyPay; 
      Payroll3(String startEmployeeName, String startID, double startHourlyPay, double startHoursWorked, double startWeeklyPay)
         EmployeeName = startEmployeeName;
         ID = (int) ID;
         HourlyPay = startHourlyPay;
         HoursWorked = startHoursWorked;
			WeeklyPay = startWeeklyPay;
      public String getEmployeeName(String EmployeeName)
         return EmployeeName;
      public int getID()
         return ID;
      public double getHourlyPay()
         return HourlyPay;
      public double setHoursWorked()
         return HoursWorked;
		public double WeeklyPay()
			return WeeklyPay;
import java.util.Scanner;
   public class Payroll3Demo
     * @param args the command line arguments
      public static void main(String[] args) {
        //declare variables
         String EmployeeName;
         int ID;
         double HourlyPay;
         double HoursWorked;
         double WeeklyPay;

        // create scanner to input data
         java.util.Scanner input = new Scanner(System.in);
        //Prompt to enter employee name
         System.out.print("Enter the Employee Name: ");
         EmployeeName = input.nextLine();
        //Prompt to enter employee ID
         System.out.print("Enter the Employee ID: ");
        // Prompt for hourly pay rate
         System.out.print("Enter hourly pay rate: $");
        //Prompt for number of hours worked
         System.out.print("Enter number of hours worked: ");
        //state weekly pay amount
         System.out.print("Weekly Salary is: $"  + HourlyPay*HoursWorked);
        // Display the data.
         System.out.println("Name: " + startEmployeeName.setEmployeeName());
         System.out.println("ID: " + startID.setID());
         System.out.println("Hourly rate: " + startHourlyPay.setHourlyPay());
         System.out.println("Hours worked: " + startHoursWorked.setHoursWorked());
         System.out.println("Weekly salary: " + startWeeklyPay.setWeeklyPay());
      }//end method main
   }//end class Payroll3

When I compile Payroll3Demo, the following errors are displayed:

Payroll3Demo.java:47: cannot find symbol
symbol : variable startEmployeeName
location: class Payroll3Demo
System.out.println("Name: " + startEmployeeName.setEmployeeName());
Payroll3Demo.java:48: cannot find symbol
symbol : variable startID
location: class Payroll3Demo
System.out.println("ID: " + startID.setID());
Payroll3Demo.java:49: cannot find symbol
symbol : variable startHourlyPay
location: class Payroll3Demo
System.out.println("Hourly rate: " + startHourlyPay.setHourlyPay());
Payroll3Demo.java:50: cannot find symbol
symbol : variable startHoursWorked
location: class Payroll3Demo
System.out.println("Hours worked: " + startHoursWorked.setHoursWorked());
Payroll3Demo.java:51: cannot find symbol
symbol : variable startWeeklyPay
location: class Payroll3Demo
System.out.println("Weekly salary: " + startWeeklyPay.setWeeklyPay());
5 errors

6 Years
Discussion Span
Last Post by NormR1

The "cannot find symbol" message is telling you that the compiler can not find a definition for the symbol named in the error message that is defined in scope where the symbol is being referenced.
For each one you need to see why you are using a symbol that is NOT defined where you are trying to use it.

It looks like you have left a lot of definitions out of the code.
Take the error messages one at a time and find why you are coding it where it is and what you need to do to get the data that you want in that statement.

Some of your uses of methods don't make sense. You are calling a method named: setEmployeeName() where it looks like you would want to get the name for printing.

You need to review that whole part of the code at the end of the main() method to see what it is supposed to do and where the data is located that you want to print.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.