Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with simple code

Status
Not open for further replies.

bigred925

MIS
Jul 6, 2001
15
US
I keep getting the error: employee.java:78: cannot resolve symbol
symbol : class Employee
location: class employee


import java.applet.Applet;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import javax.swing.JOptionPane;



public class employee extends Applet

{
public void init()

// protected String newName;
// protected float totalPay;
{

//First Employee
String name1;
name1 = JOptionPane.showInputDialog("Enter the hourly workers name:");
employee1 = new Employee(name1);

String input2;
input2 = JOptionPane.showInputDialog("Enter the number of hours worked:");
float hours1 = Float.parseFloat(input2);
employee1.getHours(hours1);

String input3;
input3 = JOptionPane.showInputDialog("Enter the payrate:");
float rate1 = Float.parseFloat(input3);
employee1.getPayRate(rate1);


//Second Student
String name2;
name2 = JOptionPane.showInputDialog("Enter the salary workers name:");
employee2 = new Employee(name2);

String input5;
input5 = JOptionPane.showInputDialog("Enter the number of hours worked:");
float hours2 = Float.parseFloat(input5);
employee2.getHours(hours2);

String input6;
input6 = JOptionPane.showInputDialog("Enter the payrate:");
float rate2 = Float.parseFloat(input6);
employee2.setAnnualPay(rate2);



}

public void paint(Graphics g)
{
Graphics2D g2 = (Graphics2D)g;

//Center Text
int center = getWidth()/3;


g2.drawString("Employee Applet ", center, 20);
g2.drawString(" Name Gross Pay ", center, 20);
//First student
g2.drawString("Hourly Employee: "+ employee1.getName()+employee1.computePay() , center, 50);


//Second student
g2.drawString("Salaried Employee"+ employee2.getName()+employee2.calcTotalPay(), center,100);


}
private Employee employee1;
private Employee employee2;
}
Thanks for any help!!
 
Your class name is employee, it should be Employee. Also this will mean the name of the file should change to Employee.java. Case is very important and it is standard practice to capitalize class names.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top