10 Replies - 10950 Views - Last Post: 05 September 2007 - 01:18 AM Rate Topic: -----

#1 cmymazda  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 27-August 07

Payroll program part 3

Posted 03 September 2007 - 07:15 PM

Please help me with this error C:\IT315\Payroll 3\Payroll 3.java:6: '{' expected
public class Payroll 3 {

Here is my code below.

//Payroll 3
import java.util.Scanner;

public class Payroll 3 {

  
	// main begin Java application
	public static void main (String []args) {
		   Scanner input = new Scanner(System.in);
		   String name; // employee name
		   
		   if (name.getName().equals("Stop"))
				{	   
				   System.out.println("Stop Entered,");
				   //stop = true;
				   Quit ();
				  }// end if
				  else
				  System.out.print ("\nEnter Employee Name: ");//prompt for name
				  name.setName(input.nextLine());// get name
				  if (name.getName().equals ("stop")); 
				  {
				   System.out.println("Stop Entered,");
				   //stop = true;
				   Break ();
				   
				   // Loop until user types "stop" as name: while (!stop)
				  }// end if
				  
											
				  System.out.print ("Enter Employee payRate: $"); //prompt
				  name.setpayRate = (input.nextDouble());
				  if (name.getpayRate() <=0)  
				  {
						   System.out.println ("Invalid amount, setpayRate must be positive");
						   System.out.print ("Please enter valid payrate: $");
						   name.setpayRate = (input.nextDouble());
						   // Loop until valid number is entered for payrate: while (setpayRate < 0.0)
					} // end if
				   System.out.print ("Enter number hours worked: ");
				   name.sethoursWorked = (input.nextDouble());
				   if (name.gethoursWorked() <=0)   {
						 System.out.println ("Invalid amount, hoursWorked must be positive");
						 System.out.print ("Please enter valid hourWorked: ");
						 name.sethoursWorked = (input.nextDouble());
						 // Loop until valid number of hours is entered: while (name.sethourWorked < 0.0)
					}//end if
	 
								 
				  System.out.printf(" %s's weekly earned pay is: $%.2f\n", name, earnedPay);
				  Quit();
  
	  }// end  method main
  
   }//end class Payroll 3

//  Class Employee
class Employee 

{
				 String name;
				 private double hourlyRate;
				 private double hourWorked;
				 public Employee ()
				   {
					   //implicit call to object constructor occurs here
						name = "";
						payRate = 0.0;
						hoursWorked = 0.0;
					 }
				 // Three argument initialization constructor
			  public Employee(String employeenameIn, double hourlyRateInDollarsIn, double hoursWorkedInWeekIn)
					{
					   //implicit call to object constructor occurs here
						   name = NameIn;
						   hourlyRate = hourlyWageInDollarsIn;
						   hoursWorked = hoursWorkedInWeekIn;
					} // end three argument intialization constructor
				   public void name (string name) {
						   this.name = name;
					}
					String getName ()
					{
							return name;
					 }
					 public void setpayRate (double payRate)
					{
							this.payRate = payRate;
					 }
					 public double getpayRate ()
					 {
							 return payRate;
					 }
					 public void sethoursWorked ()
					 {
							 this.hoursWorked = hours;
					  }
					 public double gethoursWorked ()
					  {
							  return hours;
					   }
					 public double getearnedPay ()
					   {
							  return (payRate * hoursWorked);
					   }
	}// end class Employee
edit: PLEASE USE CODE TAGS

This post has been edited by PennyBoki: 03 September 2007 - 07:25 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Payroll program part 3

#2 PennyBoki  Icon User is offline

  • system("revolution");
  • member icon

Reputation: 53
  • View blog
  • Posts: 2,334
  • Joined: 11-December 06

Re: Payroll program part 3

Posted 03 September 2007 - 07:37 PM

The name of your class should be Payroll3 instead of Payroll 3, same withe the .java file name
Was This Post Helpful? 0
  • +
  • -

#3 cmymazda  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 27-August 07

Re: Payroll program part 3

Posted 03 September 2007 - 09:06 PM

View PostPennyBoki, on 3 Sep, 2007 - 07:37 PM, said:

The name of your class should be Payroll3 instead of Payroll 3, same withe the .java file name



Hello PennyBoki,

First, thanks for your help. When I made the change I now have 27 errors... what did I do wrong?

C:\IT315\Payroll 3\Payroll 3.java:6: class Payroll3 is public, should be declared in a file named Payroll3.java
public class Payroll3 {
^
C:\IT315\Payroll 3\Payroll 3.java:81: cannot find symbol
symbol : class string
location: class Employee
public void name (string name) {
^
C:\IT315\Payroll 3\Payroll 3.java:14: cannot find symbol
symbol : method getName()
location: class java.lang.String
if (name.getName().equals("Stop"))
^
C:\IT315\Payroll 3\Payroll 3.java:18: cannot find symbol
symbol : method Quit()
location: class Payroll3
Quit ();
^
C:\IT315\Payroll 3\Payroll 3.java:22: cannot find symbol
symbol : method setName(java.lang.String)
location: class java.lang.String
name.setName(input.nextLine());// get name
^
C:\IT315\Payroll 3\Payroll 3.java:23: cannot find symbol
symbol : method getName()
location: class java.lang.String
if (name.getName().equals ("stop"));
^
C:\IT315\Payroll 3\Payroll 3.java:27: cannot find symbol
symbol : method Break()
location: class Payroll3
Break () ;
^
C:\IT315\Payroll 3\Payroll 3.java:34: cannot find symbol
symbol : variable setpayRate
location: class java.lang.String
name.setpayRate = (input.nextDouble()) ;
^
C:\IT315\Payroll 3\Payroll 3.java:35: cannot find symbol
symbol : method getpayRate()
location: class java.lang.String
if (name.getpayRate() <=0)
^
C:\IT315\Payroll 3\Payroll 3.java:39: cannot find symbol
symbol : variable setpayRate
location: class java.lang.String
name.setpayRate = (input.nextDouble());
^
C:\IT315\Payroll 3\Payroll 3.java:43: cannot find symbol
symbol : variable sethoursWorked
location: class java.lang.String
name.sethoursWorked = (input.nextDouble()) ;
^
C:\IT315\Payroll 3\Payroll 3.java:44: cannot find symbol
symbol : method gethoursWorked()
location: class java.lang.String
if (name.gethoursWorked() <=0) {
^
C:\IT315\Payroll 3\Payroll 3.java:47: cannot find symbol
symbol : variable sethoursWorked
location: class java.lang.String
name.sethoursWorked = (input.nextDouble()) ;
^
C:\IT315\Payroll 3\Payroll 3.java:52: cannot find symbol
symbol : variable earnedPay
location: class Payroll3
System.out.printf(" %s's weekly earned pay is: $%.2f\n", name, earnedPay) ;
^
C:\IT315\Payroll 3\Payroll 3.java:53: cannot find symbol
symbol : method Quit()
location: class Payroll3
Quit();
^
C:\IT315\Payroll 3\Payroll 3.java:70: cannot find symbol
symbol : variable payRate
location: class Employee
payRate = 0.0 ;
^
C:\IT315\Payroll 3\Payroll 3.java:71: cannot find symbol
symbol : variable hoursWorked
location: class Employee
hoursWorked = 0.0 ;
^
C:\IT315\Payroll 3\Payroll 3.java:77: cannot find symbol
symbol : variable NameIn
location: class Employee
name = NameIn ;
^
C:\IT315\Payroll 3\Payroll 3.java:78: cannot find symbol
symbol : variable hourlyWageInDollarsIn
location: class Employee
hourlyRate = hourlyWageInDollarsIn ;
^
C:\IT315\Payroll 3\Payroll 3.java:79: cannot find symbol
symbol : variable hoursWorked
location: class Employee
hoursWorked = hoursWorkedInWeekIn ;
^
C:\IT315\Payroll 3\Payroll 3.java:90: cannot find symbol
symbol : variable payRate
location: class Employee
this.payRate = payRate;
^
C:\IT315\Payroll 3\Payroll 3.java:94: cannot find symbol
symbol : variable payRate
location: class Employee
return payRate ;
^
C:\IT315\Payroll 3\Payroll 3.java:98: cannot find symbol
symbol : variable hoursWorked
location: class Employee
this.hoursWorked = hours ;
^
C:\IT315\Payroll 3\Payroll 3.java:98: cannot find symbol
symbol : variable hours
location: class Employee
this.hoursWorked = hours ;
^
C:\IT315\Payroll 3\Payroll 3.java:102: cannot find symbol
symbol : variable hours
location: class Employee
return hours;
^
C:\IT315\Payroll 3\Payroll 3.java:106: cannot find symbol
symbol : variable payRate
location: class Employee
return (payRate * hoursWorked) ;
^
C:\IT315\Payroll 3\Payroll 3.java:106: cannot find symbol
symbol : variable hoursWorked
location: class Employee
return (payRate * hoursWorked) ;
^
27 errors
Exit code: 1
There were errors
Was This Post Helpful? 0
  • +
  • -

#4 PennyBoki  Icon User is offline

  • system("revolution");
  • member icon

Reputation: 53
  • View blog
  • Posts: 2,334
  • Joined: 11-December 06

Re: Payroll program part 3

Posted 03 September 2007 - 09:56 PM

First as I said create a new file called Payroll3.java and the name of your class should be Payroll3.
Was This Post Helpful? 0
  • +
  • -

#5 cmymazda  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 27-August 07

Re: Payroll program part 3

Posted 03 September 2007 - 10:25 PM

View PostPennyBoki, on 3 Sep, 2007 - 09:56 PM, said:

First as I said create a new file called Payroll3.java and the name of your class should be Payroll3.



PennyBoki,

I did that and have fixed all of the errors but 1
C:\IT315\Payroll 3\Payroll3.java:50: class, interface, or enum expected
} //end class Payroll3
here is the code
//Payroll3
import java.util.Scanner;

public class Payroll3 {

  
	// main begin Java application
	public static void main (String []args) {
			Employee emp = new Employee();
		   Scanner input = new Scanner(System.in);
					   
		   double payRate;
		   double hoursWorked;
		   double earnedPay;
		   
		   while (true)
			  System.out.println("\nEnter Employee Name :");
			  emp.setName(input.next());
				
		   if (!emp.getName().equals("Stop"))
				{	
									   
							 
										
				  System.out.print ("Enter Employee payRate: $"); //prompt
				  emp.setpayRate = (input.nextDouble());
				  while (emp.getpayRate() <=0)  
				  {
						   System.out.println ("Invalid amount, setpayRate must be positive");
						   System.out.print ("Please enter valid payrate: $");
						   emp.setpayRate = (input.nextDouble());
						   // Loop until valid number is entered for payrate: while (setpayRate < 0.0)
					} // end while
				   System.out.print ("Enter number hours worked: ");
				   emp.sethoursWorked = (input.nextDouble());
				   while(emp.gethoursWorked() <=0)   {
						 System.out.println ("Invalid amount, hoursWorked must be positive");
						 System.out.print ("Please enter valid hourWorked: ");
						 emp.sethoursWorked = (input.nextDouble());
						}
						System.out.printf("%s's weekly earned pay is: $%.2f\n", name, earnedPay);
					   }
					   else break;
					  }
										  
					}// end main
					
   } //end class Payroll3					
	
   }
//  Class Employee
class Employee 

{
				 private String name;
				 private double hourlyRate;
				 private double hourWorked;
				 public Employee ()
				 
				   {
					   //implicit call to object constructor occurs here
						name = "";
						payRate = 0.0;
						hoursWorked = 0.0;
					 }
				 // Three argument initialization constructor
			  public Employee(String employeenameIn, double hourlyRateInDollarsIn, double hoursWorkedInWeekIn)
					{
					   //implicit call to object constructor occurs here
						   name = NameIn;
						   hourlyRate = hourlyWageInDollarsIn;
						   hoursWorked = hoursWorkedInWeekIn;
					} // end three argument intialization constructor
				   public void name (String name) {
						   this.name = name;
					}
					String getName ()
					{
							return name;
					 }
					 
					 public void setpayRate (double payRate)
					{
							this.payRate = payRate;
					 }
					 public double getpayRate ()
					 {
							 return payRate;
					 }
					 public void sethoursWorked ()
					 {
							 this.hoursWorked = hours;
					  }
					 public double gethoursWorked ()
					  {
							  return hours;
					   }
					 public double getearnedPay ()
					   {
							  return (payRate * hoursWorked);
					   }
	}// end class Employee


edit: please use code tags

This post has been edited by PennyBoki: 04 September 2007 - 01:30 AM

Was This Post Helpful? 0
  • +
  • -

#6 PennyBoki  Icon User is offline

  • system("revolution");
  • member icon

Reputation: 53
  • View blog
  • Posts: 2,334
  • Joined: 11-December 06

Re: Payroll program part 3

Posted 04 September 2007 - 01:48 AM

No, no, no my friend, at that moment yes the compiler shows one error but after removing that error there were many many many many many many ... many errors.

I managed to get it compile and then run, but there were other logical errors I would say in respect of what your program should do.

However I am not going to give you the code, because you had too many errors, so I don't think you'll be patient enough to try to learn by comparing. I know I wouldn't be. So I'm thinking how is the best way to try to show you what have you done, and the best I can do is give you advise: to get back on the drawing board, I mean back on the basics, there were so many basic errors, like assigning value to a function with the assignment operator, using different names for variables, working with if/else statements and while loops.

There are snippets and tutorials here that you can pick up valuable hints and tips.

With all do respect, that is my advice to you.
Sincerely PennyBoki
Was This Post Helpful? 0
  • +
  • -

#7 Trebuntou  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 04-September 07

Re: Payroll program part 3

Posted 04 September 2007 - 06:36 AM

View Postcmymazda, on 3 Sep, 2007 - 07:15 PM, said:

Please help me with this error C:\IT315\Payroll 3\Payroll 3.java:6: '{' expected
public class Payroll3 {

Here is my code below.

//Payroll 3
import java.util.Scanner;

public class Payroll3 {

  
	// main begin Java application
	public static void main (String []args) {
		   Scanner input = new Scanner(System.in);
		   String name; // employee name
		   
		   if (name.getName().equals("Stop"))
				{	   
				   System.out.println("Stop Entered,");
				   //stop = true;
				   Quit ();
				  }// end if
				  else
				  System.out.print ("\nEnter Employee Name: ");//prompt for name
				  name.setName(input.nextLine());// get name
				  if (name.getName().equals ("stop")); 
				  {
				   System.out.println("Stop Entered,");
				   //stop = true;
				   Break ();
				   
				   // Loop until user types "stop" as name: while (!stop)
				  }// end if
				  
											
				  System.out.print ("Enter Employee payRate: $"); //prompt
				  name.setpayRate = (input.nextDouble());
				  if (name.getpayRate() <=0)  
				  {
						   System.out.println ("Invalid amount, setpayRate must be positive");
						   System.out.print ("Please enter valid payrate: $");
						   name.setpayRate = (input.nextDouble());
						   // Loop until valid number is entered for payrate: while (setpayRate < 0.0)
					} // end if
				   System.out.print ("Enter number hours worked: ");
				   name.sethoursWorked = (input.nextDouble());
				   if (name.gethoursWorked() <=0)   {
						 System.out.println ("Invalid amount, hoursWorked must be positive");
						 System.out.print ("Please enter valid hourWorked: ");
						 name.sethoursWorked = (input.nextDouble());
						 // Loop until valid number of hours is entered: while (name.sethourWorked < 0.0)
					}//end if
	 
								 
				  System.out.printf(" %s's weekly earned pay is: $%.2f\n", name, earnedPay);
				  Quit();
  
	  }// end  method main
  
   }//end class Payroll 3

//  Class Employee
class Employee 

{
				 String name;
				 private double hourlyRate;
				 private double hourWorked;
				 public Employee ()
				   {
					   //implicit call to object constructor occurs here
						name = "";
						payRate = 0.0;
						hoursWorked = 0.0;
					 }
				 // Three argument initialization constructor
			  public Employee(String employeenameIn, double hourlyRateInDollarsIn, double hoursWorkedInWeekIn)
					{
					   //implicit call to object constructor occurs here
						   name = NameIn;
						   hourlyRate = hourlyWageInDollarsIn;
						   hoursWorked = hoursWorkedInWeekIn;
					} // end three argument intialization constructor
				   public void name (string name) {
						   this.name = name;
					}
					String getName ()
					{
							return name;
					 }
					 public void setpayRate (double payRate)
					{
							this.payRate = payRate;
					 }
					 public double getpayRate ()
					 {
							 return payRate;
					 }
					 public void sethoursWorked ()
					 {
							 this.hoursWorked = hours;
					  }
					 public double gethoursWorked ()
					  {
							  return hours;
					   }
					 public double getearnedPay ()
					   {
							  return (payRate * hoursWorked);
					   }
	}// end class Employee
edit: PLEASE USE CODE TAGS

// i remove the space from your class name payroll 3
// try not to use that instead use Class name payroll3
// thanks from your friend robert

Was This Post Helpful? 0
  • +
  • -

#8 PennyBoki  Icon User is offline

  • system("revolution");
  • member icon

Reputation: 53
  • View blog
  • Posts: 2,334
  • Joined: 11-December 06

Re: Payroll program part 3

Posted 04 September 2007 - 09:05 AM

Hi Trebuntou, you were saying...
Was This Post Helpful? 0
  • +
  • -

#9 cmymazda  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 27-August 07

Re: Payroll program part 3

Posted 04 September 2007 - 04:12 PM

View PostPennyBoki, on 4 Sep, 2007 - 01:48 AM, said:

No, no, no my friend, at that moment yes the compiler shows one error but after removing that error there were many many many many many many ... many errors.

I managed to get it compile and then run, but there were other logical errors I would say in respect of what your program should do.

However I am not going to give you the code, because you had too many errors, so I don't think you'll be patient enough to try to learn by comparing. I know I wouldn't be. So I'm thinking how is the best way to try to show you what have you done, and the best I can do is give you advise: to get back on the drawing board, I mean back on the basics, there were so many basic errors, like assigning value to a function with the assignment operator, using different names for variables, working with if/else statements and while loops.

There are snippets and tutorials here that you can pick up valuable hints and tips.

With all do respect, that is my advice to you.
Sincerely PennyBoki

Was This Post Helpful? 0
  • +
  • -

#10 cmymazda  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 27-August 07

Re: Payroll program part 3

Posted 04 September 2007 - 04:23 PM

View PostPennyBoki, on 4 Sep, 2007 - 01:48 AM, said:

No, no, no my friend, at that moment yes the compiler shows one error but after removing that error there were many many many many many many ... many errors.

I managed to get it compile and then run, but there were other logical errors I would say in respect of what your program should do.

However I am not going to give you the code, because you had too many errors, so I don't think you'll be patient enough to try to learn by comparing. I know I wouldn't be. So I'm thinking how is the best way to try to show you what have you done, and the best I can do is give you advise: to get back on the drawing board, I mean back on the basics, there were so many basic errors, like assigning value to a function with the assignment operator, using different names for variables, working with if/else statements and while loops.

There are snippets and tutorials here that you can pick up valuable hints and tips.

With all do respect, that is my advice to you.
Sincerely PennyBoki




Okay PennyBoki well I think now that i have all the errors cleaned up but I still not getting it to satisfy the requirements of the assignment which are:

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. 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 is readable and well
documented.

Here is my code:

//Payroll3
import java.util.Scanner;

public class Payroll3 {

	// main begin Java application
	public static void main (String[] args) {
		Employee emp = new Employee();
		Scanner input = new Scanner(System.in);

		double payRate;
		double hoursWorked;
		double earnedPay;

		while (true)
		{
			System.out.println("\nEnter Employee Name :");
			emp.setName(input.next());

			if (!emp.getName().equals("Stop")) {
				System.out.print ("Enter Employee payRate: $"); //prompt
				emp.setpayRate(input.nextDouble());
				while (emp.getpayRate() <= 0) {
					System.out.println ("Invalid amount, setpayRate must be positive");
					System.out.print ("Please enter valid payrate: $");
					emp.setpayRate(input.nextDouble());
					// Loop until valid number is entered for payrate: while (setpayRate < 0.0)
				} // end while
				System.out.print ("Enter number hours worked: ");
				emp.sethoursWorked(input.nextDouble());
				while (emp.gethoursWorked() <= 0 ) {
					System.out.println ("Invalid amount, hoursWorked must be positive");
					System.out.print ("Please enter valid hourWorked: ");
					emp.sethoursWorked(input.nextDouble());
				}
				System.out.printf("%s's weekly earned pay is: $%.2f\n", emp.getName(), emp.getpayRate());
			} else
				break;
		} // end while (true)

	} // end main

}//end class Payroll3


//  Class Employee
class Employee
{
	private String name;
	private double hourlyRate;
	private double hoursWorked;

	public Employee ()
	{
		//implicit call to object constructor occurs here
		name = "";
		hourlyRate = 0.0;
		hoursWorked = 0.0;
	}

	// Three argument initialization constructor
	public Employee(String employeenameIn, double hourlyRateInDollarsIn, double hoursWorkedInWeekIn) {
		//implicit call to object constructor occurs here
		name = employeenameIn;
		hourlyRate = hourlyRateInDollarsIn;
		hoursWorked = hoursWorkedInWeekIn;
	} // end three argument intialization constructor

	public void setName (String name) {
		this.name = name;
	}

	public String getName () {
		return name;
	}

	public void setpayRate (double payRate) {
		this.hourlyRate = payRate;
	}

	public double getpayRate () {
		return hourlyRate;
	}

	public void sethoursWorked (double hours) {
		this.hoursWorked = hours;
	}

	public double gethoursWorked () {
		return hoursWorked;
	}

	public double getearnedPay () {
		return hourlyRate * hoursWorked;
	}

} // end class Employee



Was This Post Helpful? 0
  • +
  • -

#11 PennyBoki  Icon User is offline

  • system("revolution");
  • member icon

Reputation: 53
  • View blog
  • Posts: 2,334
  • Joined: 11-December 06

Re: Payroll program part 3

Posted 05 September 2007 - 01:18 AM

Ok try this code, it's your code I just modified it a little, and try to find out what I did.

//Payroll3
import java.util.Scanner;

public class Payroll31 {

	// main begin Java application
	public static void main (String[] args) {
		Employee emp = new Employee();
		Scanner input = new Scanner(System.in);

		double payRate;
		double hoursWorked;
		double earnedPay;

		while (true)
		{
			System.out.println("\nEnter Employee Name :");
			emp.setName(input.next());

			if (!emp.getName().equalsIgnoreCase("Stop"))
			{
				
					System.out.print ("Enter Employee payRate: $"); //prompt
					emp.setpayRate(input.nextDouble());
					
					while (emp.getpayRate() <= 0) 
					{
						
						System.out.println ("Invalid amount, setpayRate must be positive");
						System.out.print ("Please enter valid payrate: $");
						emp.setpayRate(input.nextDouble());
						// Loop until valid number is entered for payrate: while (setpayRate < 0.0)
					} // end while
						
					System.out.print ("Enter number hours worked: ");
					emp.sethoursWorked(input.nextDouble());
					while (emp.gethoursWorked() <= 0 )
					{
						
						System.out.println ("Invalid amount, hoursWorked must be positive");
						System.out.print ("Please enter valid hourWorked: ");
						emp.sethoursWorked(input.nextDouble());
					}
					
				System.out.printf("%s's weekly earned pay is: $%.2f\n", emp.getName(), emp.getpayRate()*emp.gethoursWorked ());
			} 
			else
				break;
		} // end while (true)

	} // end main

}//end class Payroll3


//  Class Employee
class Employee
{
	private String name;
	private double hourlyRate;
	private double hoursWorked;

	public Employee ()
	{
		//implicit call to object constructor occurs here
		name = "";
		hourlyRate = 0.0;
		hoursWorked = 0.0;
	}

	// Three argument initialization constructor
	public Employee(String employeenameIn, double hourlyRateInDollarsIn, double hoursWorkedInWeekIn) {
		//implicit call to object constructor occurs here
		name = employeenameIn;
		hourlyRate = hourlyRateInDollarsIn;
		hoursWorked = hoursWorkedInWeekIn;
	} // end three argument intialization constructor

	public void setName (String name) {
		this.name = name;
	}

	public String getName () {
		return name;
	}

	public void setpayRate (double payRate) {
		this.hourlyRate = payRate;
	}

	public double getpayRate () {
		return hourlyRate;
	}

	public void sethoursWorked (double hours) {
		this.hoursWorked = hours;
	}

	public double gethoursWorked () {
		return hoursWorked;
	}

	public double getearnedPay () {
		return hourlyRate * hoursWorked;
	}

} // end class Employee

Was This Post Helpful? 2

Page 1 of 1