Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

class, interface, or enum expected error

843810May 3 2009 — edited May 9 2009
I am getting this error in the program I have written. I have checked all my bracets to make sure the start and close with leaving anything open. I can not figure out why I am getting this error. Can someone help?

// Payroll3.java
// Calculates weekly payroll

import java.util.Scanner; <------------ This is where I am getting an error that says "Payroll3.java:64: class, interface, or enum expected"
public class Employee
{

private string empname;
private double hourlyrate;
private double hoursworked;

//method to set the name
public void setEmpName( String name )
{
empname = name;
} // end method

//method to retrieve the employee name
public String getEmpName()
{
return empname;
} // end method

// method to display employee name
public void displayMessage()
{
System.out.printf( "Employee's name is: %\n", getEmpName() );
} // end method

//method to set hourly rate
public void setHourlyrate( double hourlyrate )
{
hourlyrate = hourlyrate;
} // end method

// method to retrieve hourly rate
public double getHourlyrate()
{
return hourlyrate;
} // end method


// method to set hours
public void SetHours( double hours)
{
hours = hours;
} // end method

// method to retrieve hours
public double getHours()
{
return hours;
} // end method

public double getPay()
{
return hourlyrate * hours;
}
} // end class employee

// calculate weekly pay

import java.util.Scanner;

public class calculate
{

//main method begins execution of java application
public static void main( String args[] )
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 6 2009
Added on May 3 2009
2 comments
352 views