java - Cannot find symbol - method -


having hard time calling method in main. keeps saying cannot find symbol - method addsales(double)

i doing project programming because learnt inheritance , has 3 super classes , 3 sub classes. having problem 1 sub , super class. named hourly , commission. commission extends hourly. feel have written method called addsales correctly when call in main says cannot find method. missing here? appreciated.

commission class:

public class commission extends hourly { private double totalsales, commission;  public commission(string ename, string eaddress, string ephone, string socsecnumber, double rate, double commissionrate) {     super(ename, eaddress, ephone, socsecnumber, rate);     totalsales = 0.0;     commission = commissionrate; }  public double pay() {     double payment = super.pay();     payment = (payment + (commission * totalsales));     return payment; } public string tostring() {     string result = super.tostring();     result += "total sales: " + totalsales;      return result;  } public void addsales(double totals) {     totalsales = totalsales + totals; } } 

hourly class:

public class hourly extends employee { private int hoursworked;  //----------------------------------------------------------------- //  sets hourly employee using specified information. //----------------------------------------------------------------- public hourly (string ename, string eaddress, string ephone, string socsecnumber, double rate) {     super (ename, eaddress, ephone, socsecnumber, rate);      hoursworked = 0; }  //----------------------------------------------------------------- //  adds specified number of hours employee's //  accumulated hours. //----------------------------------------------------------------- public void addhours (int morehours) {     hoursworked += morehours; }  //----------------------------------------------------------------- //  computes , returns pay hourly employee. //----------------------------------------------------------------- public double pay() {     double payment = payrate * hoursworked;      hoursworked = 0;      return payment; }  //----------------------------------------------------------------- //  returns information hourly employee string. //----------------------------------------------------------------- public string tostring() {     string result = super.tostring();      result += "\ncurrent hours: " + hoursworked;      return result; } } 

main:

public class firm { //-------------------------------------------------------------- //  creates staff of employees firm , pays them. //-------------------------------------------------------------- public static void main (string[] args) {     staff personnel = new staff(8);      executive staff0 = new executive ("sam", "123 main line", "555-0469", "123-45- 6789", 2423.07);     staffmember staff1 = new employee ("carla", "456 off line", "555-0101", "987-65-4321", 1246.15);     staffmember staff2 = new employee ("woody", "789 off rocker", "555-0000", "010-20-3040", 1169.23);      hourly staff3 = new hourly ("diane", "678 fifth ave.", "555-0690", "958-47-3625", 10.55);      hourly staff6 = new commission("marcus gendron", "66 highland st.", "272-9555", "123-62-5678", 6.25, 0.20);     hourly staff7 = new commission("joe dangerous", "55 dude court", "555-1267", "777-66-5555", 9.75, 0.15);      staffmember staff4 = new volunteer ("norm", "987 suds blvd.", "555-8374") ;     staffmember staff5 = new volunteer ("cliff", "321 duds lane", "555-7282");        personnel.addstaff(staff0);     personnel.addstaff(staff1);     personnel.addstaff(staff2);     personnel.addstaff(staff3);     personnel.addstaff(staff4);     personnel.addstaff(staff5);     personnel.addstaff(staff6);     personnel.addstaff(staff7);          staff6.addhours(35);     staff6.addsales(400.0);       //error being shown here ^^^^       staff7.addhours(40);     staff7.addsales(950.00);     staff0.awardbonus (500.00);     staff3.addhours (40);     personnel.payday(); } } 

both staff6 , staff7 instances of hourly. hourly class not have particular method attached it.

you have declare them concrete instances of commission instead.


Comments

Popular posts from this blog

How to access named pipes using JavaScript in Firefox add-on? -

multithreading - OPAL (Open Phone Abstraction Library) Transport not terminated when reattaching thread? -

node.js - req param returns an empty array -