Working on Payroll Program Part 2 and getting multiple errors
I am trying to work on modifying payroll program part 1 and my code is not working. Not sure what I am missing and not really understanding the error messages. Can someone please look at my code and tell me what I am doing wrong?
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package payrollprogram;
/**
*
* @author
*/
import java.util.Scanner;
public class PayrollProgram {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// declare variables
String employeeName;
double hourlyPay;
double hoursWorked;
double weeklyPay;
double overtimeHours;
double overtimeRate;
double overtimePay;
double totalHours;
boolean stop = false;
//create scanner to imput data
java.util.Scanner input = new Scanner(System.in);
while (stop == false)
{
// prompt for employee name or the word stop to exit
System.out.print("Please enter the Employee's name or stop to exit the program: ");
employeeName=input.nextLine();
if (employeeName.equalsIgnoreCase("stop"));
{
System.out.println("Exiting Program");
stop = true;
}// ends if statement
else
{
//prompt for hourly rate
System.out.println("Please enter the employee's hourly rate of pay: ");
hourlyPay = input.nextDouble();
}//end else
while (hourlyPay < 0) //checks for a negative value
{
System.out.println("Please enter a positive number: ");
hourlyPay = input.nextDouble();
}//end while statement
System.out.println("Please enter the number of hours worked for this employee: ")// prompt for number of hours worked
hoursWorked = input.nextDouble();
while (hoursWorked < 0)// checks for a negative value
{
System.out.println("Please enter a positive number: ");
hoursWorked = input.nextDouble();
}//end while
if (hoursWorked > 40) // determines if employee has overtime
{
//calculate pay
weeklyPay = hoursWorked*hourlyPay
overtimePay = (hoursWorked - 40)*(hourlyPay*1.5)
totalHours = hoursWorked + overtimeHours
//if employee has overtime display information
System.out.println("Employee: " + employeeName);
System.out.printf("Hourly pay rate: $%.2f\n", hourlyPay);
System.out.println("Total number of hours worked: " + totalHours);
System.out.printf("Weekly pay: $%.2f\n", weeklyPay+overtimePay)
}//end if
else
// if employee does not have overtime display information
{
System.out.println("Employee: " + employeeName);
System.out.printf("Hourly pay rate: $%.2f\n", hourlyPay);
System.out.println("Total number of hours worked: " + hoursWorked);
System.out.printf("Weekly pay: $%.2f\n", weeklyPay)
}
}//end while
}//end method main
}//end class PayrollProgram
These are the errors I am receiving:
java.lang.ClassFormatError: Duplicate field name&signature in class file payrollpgm/PayrollPgm
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader. java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java :615)
at java.security.SecureClassLoader.defineClass(Secure ClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader .java:283)
at java.net.URLClassLoader.access$000(URLClassLoader. java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java: 197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.j ava:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:3 06)
at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:2 47)
Could not find the main class: payrollpgm.PayrollPgm. Program will exit.
Exception in thread "main" Java Result: 1
BUILD SUCCESSFUL (total time: 1 second)