java - 0.00 should not be the answer -


package companyemployees;  public class doemployeepayroll {      public static void main(string args[]) {          fulltimeemployee ftemployee = new fulltimeemployee();          ftemployee.setname("barry burd");         ftemployee.setjobtitle("ceo");         ftemployee.setweeklysalary(5000.00);         ftemployee.setbenefitdeduction(500.00);         ftemployee.cutcheck(ftemployee.findpaymentamount());         system.out.println();          parttimeemployee ptemployee = new parttimeemployee();          ptemployee.setname("steve surace");         ptemployee.setjobtitle("driver");         ptemployee.sethourlyrate(7.53);         ptemployee.cutcheck(ptemployee.findpaymentamount(10));     } }  package companyemployees; import static java.lang.system.out;  public class employee {      private string name;     private string jobtitle;      public void setname(string namein) {         name = namein;     }      public string getname() {         return name;     }      public void setjobtitle(string jobtitlein) {         jobtitle = jobtitlein;     }      public string getjobtitle() {         return jobtitle;     }      public void cutcheck(double amountpaid) {         out.printf("pay order of %s ", name);         out.printf("(%s) ***$", jobtitle);         out.printf("%,.2f\n", amountpaid);     } }   package companyemployees;  public class parttimeemployee extends employee {      private double hourlyrate;      public void sethourlyrate(double ratein) {         ratein = hourlyrate;     }      public double gethourlyrate() {         return hourlyrate;     }      public double findpaymentamount(int hours) {         return hourlyrate * hours;     } } 

i calculated full time employee it's part time won't come out right. payment should 75.30 outputs 0.00.

you've reversed arguments here

private double hourlyrate; public void sethourlyrate(double ratein) {   ratein = hourlyrate; } 

should be

public void sethourlyrate(double ratein) {   this.hourlyrate = ratein; } 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -