Package homework3

Source Code of homework3.BasePlusCommissionEmployee

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package homework3;

import org.omg.CORBA.DynAnyPackage.InvalidValue;

/**
*
* @author ASUS
*/
public class BasePlusCommissionEmployee extends CommissionEmployee {
   
// <editor-fold defaultstate="expanded" desc="Private Data Members">
   
    private Integer baseSalary;
   
// </editor-fold>
   
// <editor-fold defaultstate="expanded" desc="Constructors">
   
    public BasePlusCommissionEmployee(String FirstName, String LastName, long NationalSN, double Rate, int Sales, int Salary) throws InvalidValue
    {
        super(FirstName,LastName,NationalSN,Rate,Sales);
        setBaseSalary(Salary);
    }
   
// </editor-fold>

// <editor-fold defaultstate="expanded" desc="Getters and Setters">
   
    public final Integer getBaseSalary() {
        return baseSalary;
    }

    public final void setBaseSalary(Integer baseSalary) throws InvalidValue {
        if (baseSalary>0)
            this.baseSalary = baseSalary;
        else
            throw new InvalidValue("Base salary cannot be negative");
    }
   
// </editor-fold>
   
    public @Override Double earning()
    {
        return baseSalary + super.earning();
    }
   
    public @Override String toString()
    {
        String Temp = "Base Plus "
                    + super.toString()
                    + "\nSalary: " + baseSalary.toString();
        return Temp;
    }
   
    public @Override Double getPaymentAmount()
    {
        return earning();
    }
   
}
TOP

Related Classes of homework3.BasePlusCommissionEmployee

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.