View Single Post
  #7 (permalink)  
Old 05-07-2008, 08:29 PM
Azzia Azzia is offline
Member
 
Join Date: May 2008
Location: Ohio
Posts: 20
Azzia is on a distinguished road
Send a message via AIM to Azzia Send a message via MSN to Azzia
Oh wow. Well that explains a lot that the text book doesnt cover. When explaining floats and doubles, the text just says when to use them and why. Looking though it now, it never mentions that classes won't be compatible if their type isn't the same.

I am still having an issue though. I declared the string "empName" but when I use the constructor it is still giving me an error. Here is a copy of how I implemented your code into mine to see how it worked. (I also tried several different approaches by changing some things but each seem to bite the dust.)


Code:
Employee employee = new Employee ( empName, hoursWorked, payRate); System.out.printf( "Employee Name: %s, Weekly pay is $%d%n", employee.empName, employee.getWeeklyPay() ); // total = (double) PayRate * HoursWorked; // Multiply PayRate by HoursWorked // System.out.println(); // System.out.println("Employee: " + empName); //display name // System.out.println("Number of hours worked this pay week: " + HoursWorked); //display hours worked // System.out.printf("Employee's Pay: $%,.2f\n", total); //display pay rate // System.out.println(); // System.out.println(); } // end else } //end while } // end main } // end class

Last edited by Azzia : 05-07-2008 at 08:36 PM.
Reply With Quote