代码改变世界

第四次实训作业

2019-06-05 15:21  飘转至原点  阅读(206)  评论(0编辑  收藏  举报
package LHB.inherit;

public class Electricityfees 
{
   private int lastmonth,thismonth;/*上月电表读数,本月电表读数*/
   public Electricityfees()
   {
       
   }
   public Electricityfees(int lastmonth,int thismonth)
   {
       this.lastmonth=lastmonth;
       this.thismonth=thismonth;
   }
   public int getLastmonth() 
    {
    return lastmonth;
    }

   public void setLastmonth(int lastmonth) 
    {
    this.lastmonth = lastmonth;
    }

  public int getThismonth() 
   {
    return thismonth;
   }

  public void setThismonth(int thismonth) 
   {
    this.thismonth = thismonth;
   }
   public void print()
   {
       System.out.print("上月电表读数为:"+lastmonth+"  ");
       System.out.println("这个月电表读数为:"+thismonth+"  ");
   }
}