I have my project done in NetBeans, and it runs fine with no errors. However, when I try to compile the main class it says : C:\Users\Lynn\Documents\NetBeansProjects\EmployeeInfo\src\employeeinfo>javac Emp
loyeeInfo.java
EmployeeInfo.java:35: cannot find symbol
symbol : class Name
location: class employeeinfo.EmployeeInfo
Name saveInfo;
^
EmployeeInfo.java:83: cannot find symbol
symbol : class Name
location: class employeeinfo.EmployeeInfo
saveInfo = new Name (employee, rate, hours, totalPay);
^
from the command prompt.

Here is my code:

/*Modify the Payroll Program so that it uses a class to store and retrieve 
*the employee's name, the hourly rate, and the number of hours worked. Use 
*a constructor to initialize the employee information, and a method within 
*that class to calculate the weekly pay. Be sure that the method considers 
*payment of overtime.  Once stop is entered as the employee name, the 
*application should terminate. Make sure the program maintains all the
*functionality required in previous assignments and your source code
*readable and well documented.
*To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package employeeinfo;

/**
 *
 * @author Lynn
 */


import java.util.Scanner;

public class EmployeeInfo {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
       String employee = null;
       double rate;
       int hours;
       int count = 0; // number of employees
       int overTimeHours;
       double totalPay = 0;
       EmpInfo saveInfo;
       Scanner input = new Scanner(System.in);
       
       int counter;      
       counter = 0;      
          
             
       boolean moreEmps = true; 
             
      
              
               
        System.out.println("Welcome to the employee payroll program:");
        System.out.println("Enter stop to quit");
        
       
       while (moreEmps) {          
          System.out.println("Enter employees last name, first name, ");
           employee = input.next();
           
       if(employee.equalsIgnoreCase("stop"))
{
moreEmps = false;
System.out.println("Thank you for using the payroll program. ");
}
       else 
{
   counter++; 
              
                                    
                            
              
       System.out.println("Enter employees pay rate per hour: $");
       rate = input.nextDouble();
       // prompt for user to enter positive rate amount
       while (rate <=0){
          System.out.println("Please enter a valid positive rate amount.");
          rate = input.nextDouble();
       }     
                
                           
          System.out.println("Enter employees weekly hours: ");
          hours = input.nextInt();
          
                   
          while (hours <= 0){
             System.out.println("Please enter a positive amount of hours worked.");
             input.nextInt();
       }             
                 
           saveInfo = new EmpInfo (employee, rate, hours, totalPay);   
          
          System.out.println("Employee: " + saveInfo.getemployee()); 
          System.out.println("Employee: " + saveInfo.getrate());
          System.out.println("Employee: " + saveInfo.gethours());
          System.out.println("Total Pay: $" + saveInfo.gettotalPay());     
                
                   
                      
         System.out.println("Total employees entered: " + counter);
        
        
        
}     
    }
}
}

Your error messages do not go with the code you posted.
The error message: Name saveInfo;
The code: EmpInfo saveInfo;

Please change one or the other or both so the posted error message is for the posted code.

Where are the classes Name and/or EmpInfo defined?
The compiler can not find their definitions.

Where is your EmpInfo class?

Sorry, I just changed the class name, rebuilt the code, ect to try to get it to compile. This is what the prompt is saying now:

: C:\Users\Lynn\Documents\NetBeansProjects\EmployeeInfo\src\employeeinfo>javac Emp
loyeeInfo.java
EmployeeInfo.java:33: cannot find symbol
symbol : class EmpInfo
location: class employeeinfo.EmployeeInfo
EmpInfo saveInfo;
^
EmployeeInfo.java:83: cannot find symbol
symbol : class EmpInfo
location: class employeeinfo.EmployeeInfo
saveInfo = new EmpInfo (employee, rate, hours, totalPay);

/*Modify the Payroll Program so that it uses a class to store and retrieve 
*the employee's name, the hourly rate, and the number of hours worked. Use 
*a constructor to initialize the employee information, and a method within 
*that class to calculate the weekly pay. Be sure that the method considers 
*payment of overtime.  Once stop is entered as the employee name, the 
*application should terminate. Make sure the program maintains all the
*functionality required in previous assignments and your source code
*readable and well documented.
*To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package employeeinfo;

/**
 *
 * @author Lynn
 */

import java.util.Scanner;

public class EmployeeInfo {

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
       String employee = null;
       double rate;
       int hours;
       int count = 0; // number of employees
       int overTimeHours;
       double totalPay = 0;
       EmpInfo saveInfo;
       Scanner input = new Scanner(System.in);
       
       int counter;      
       counter = 0;      
          
             
       boolean moreEmps = true; 
             
      
              
               
        System.out.println("Welcome to the employee payroll program:");
        System.out.println("Enter stop to quit");
        
       
       while (moreEmps) {          
          System.out.println("Enter employees last name, first name, ");
           employee = input.next();
           
       if(employee.equalsIgnoreCase("stop"))
{
moreEmps = false;
System.out.println("Thank you for using the payroll program. ");
}
       else 
{
   counter++; 
              
                                    
                            
              
       System.out.println("Enter employees pay rate per hour: $");
       rate = input.nextDouble();
       // prompt for user to enter positive rate amount
       while (rate <=0){
          System.out.println("Please enter a valid positive rate amount.");
          rate = input.nextDouble();
       }     
                
                           
          System.out.println("Enter employees weekly hours: ");
          hours = input.nextInt();
          
                   
          while (hours <= 0){
             System.out.println("Please enter a positive amount of hours worked.");
             input.nextInt();
       }             
                 
           saveInfo = new EmpInfo (employee, rate, hours);   
          
          System.out.println("Employee: " + saveInfo.getemployee()); 
          System.out.println("Employee: " + saveInfo.getrate());
          System.out.println("Employee: " + saveInfo.gethours());
          System.out.println("Total Pay: $" + saveInfo.gettotalPay());     
                
                   
                      
         System.out.println("Total employees entered: " + counter);
        
        
        
}     
    }
}
}

^
from the command prompt.

You are using a package spec employeeinfo.EmployeeInfo, so the compiler expects to find EmployeeInfo.java in a directory employeeinfo - ie your directory structure must exactly match the package structure.

You are using a package spec employeeinfo.EmployeeInfo, so the compiler expects to find EmployeeInfo.java in a directory employeeinfo - ie your directory structure must exactly match the package structure.

It won't let me paste a print screen to show you my NetBeans projects, but the EmployeeInfo.java is in the employeeinfo directory along with my other class that compiles just fine. This has really got me stumped.

If you were using the javac command to compile your code, you would need to set the classpath to point to the folder containing the employeeinfo folder.

Is your IDE supposed to do that for you?

Thank you everyone!! The problem is fixed!! I used javac *.java and it worked (thanks to a tip from a person)

Sorry I do not find any class named EmpInfo.

Sorry I do not find any class named EmpInfo.

Thank you for responding. The error is fixed now and compiled. Someone told me to try javac *.java and it worked great!! Thanks to everyone and their quick responses I am now done with a two week project :D

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.