only 1 error.

the compiler says it 'cannot find symbol' in the line of code approximately 12 rows down that reads "Payroll employee = new Payroll();".

Thank You

import java.util.Scanner; // Needed for the Scanner class

public class PayrollDemo
{
	public static void main(String[] args)
	{
		//Declare vaiables
		String name;
		int idNumber;
		double hoursWorked;
		double payRate;
		
		//Declare object and variable to reference object
		Payroll employee = new Payroll();
		Payroll employee1;
		
		// Create a Scanner object
		Scanner keyboard = new Scanner(System.in);
		
		//Acquire and set the employee's name
		System.out.print("Enter your name: ");
		name = (keyboard.nextLine());
		employee.setName(name);
		
		//Consume remaining new line
		System.out.println("Press Enter Again");
		keyboard.nextLine();
		
		//Acquire and set the employee's ID number
		System.out.print("Enter your employee ID number: ");
		idNumber = (keyboard.nextInt());
		employee.setIdNumber(idNumber);
				
		//Acquire the employee's hourly pay rate
		System.out.print("Enter your hourly pay rate: ");
		payRate = keyboard.nextDouble();

		//Acquire and set the number of hours worked
		System.out.print("Enter how many hours you worked: ");
		hoursWorked = keyboard.nextDouble();
		
		//Initialize employee1 variable
		employee1 = new Payroll(payRate, hoursWorked);
		
		//Display employee info
		System.out.println("Employee Payroll Data");
		System.out.println("Name: " + employee.getName());
		System.out.println("ID Number: " + employee.getIdNumber());
		System.out.println("Hourly Pay Rate: " + employee.getPayRate());
		System.out.println("Hours Worked: " + employee.getHoursWorked());
		System.out.println("Gross Pay: " + employee.getGrossPay());
	}
}

Recommended Answers

All 3 Replies

Where is your Payroll class definition?

Where is your Payroll class definition?

I got a PM, and solved it.

How do I change the status to solved?

I got a PM, and solved it.

How do I change the status to solved?

By creating appropriate type of thread. As you already found from automated personal message do not use CODE SNIPPETS option to post your questions. Use FORUM THREAD and then you can mark it solved...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.