hi danpost: I am doing another one of my practice program and I am an error as usual. There is: incompatible types: boolean cannot be converted to double, i have been for the life of me trying to find where is the boolean part of it but i cannot see it.
can u tell me where it is and how to fix it. here is the codes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | public class HourlyEmployee extends Employee { String firstname; double hourlywage; float rate; double comPay; double hourlyWage; double hoursWorked; double totalpay= 0 ; double wage; double hours; public HourlyEmployee(String firstname, double hourlywage) { super (firstname, hourlywage); setWage(hourlyWage); setHours(hoursWorked); } public double comPay(){ return 0 ; } public String getfirstname(){ return firstname; } public double gethourlywage(){ return hourlywage; } public void setfirstname(String firstname){ this .firstname = firstname; } public void sethourlywage( double hourlywage){ this .hourlywage = hourlywage; } public double getWage(){ return wage; } public void setWage( double hourlyWage) { // wage = } public double getHours() { return hours; } public void setHours( double hoursWorked){ totalpay = (hoursWorked >= 40 ) && (hoursWorked <= 1.5 ); there is where the error is: (incompatible types: boolean cannot be converted to double ) that is the error } public double earnings(){ if (getHours()<= 40 ) return getWage()* getHours(); return 40 * getWage() +(getHours() - 40 * getWage() * 1.5 ); } @Override public String toString(){ return "Employees details" + " " + "First name is " + firstname+ "" + "Hourlywage is " +hourlywage; } |