View Single Post
  #8 (permalink)  
Old 05-07-2008, 08:43 PM
hardwired hardwired is offline
Senior Member
 
Join Date: Jul 2007
Posts: 1,189
hardwired is on a distinguished road
Code:
String Empname; double PayRate; double HoursWorked; double total; ... // Create an instance of Employee with this data: Employee employee = new Employee(Empname, hoursWorked, payRate);
Java will look for a constructor in Employee that matches this type signature:
Code:
class Employee { ... public Employee(String arg1, double arg2, double arg3) { ... } ... }
Your Employee class can look like this:
Code:
class Employee { String name; double payRate; double hours; double total; Employee(String name, double payRate, double hours) { this.name = name this.payRate = payRate; this.hours = hours; } ... }
Reply With Quote