researchexpense.java

来自「关于汽车的购买系统,收费系统,汽车耗油系统,是早期和同学开发的JAVA程序」· Java 代码 · 共 46 行

JAVA
46
字号


package homework;

public class ResearchExpense extends Expense {
   protected double cost;
   protected double tax;
    final int RD_COEFF=2;
    

    public ResearchExpense() {
        this("3000","shopping",5000,100);
    }
    public ResearchExpense(String date,String description, double cost,double tax) {
        super(date,description)
        setCost(cost);
        setTax(tax);
        
    }
       public void setCost(double cost){
           this.cost=cost;
       }
       double getCost(){
           return this.cost;
       }
       public void setTax(double tax){
           this.tax=tax;
       }
       double getTax(){
           return this.tax;
       }
       double getTotal(){
           return this.tax+this.cost;
       }
          public int getRDPoints(){
           return ((int)(this.getCost()))*RD_COEFF;
       } 
       public String toString(){
      return  super.toString()+"  cost: "+this.getCost()+"  tax:  "+this.getTax()+"\n";
                   
        
        }
       
       
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?