电费管理类
Posted wannengc
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了电费管理类相关的知识,希望对你有一定的参考价值。
package bbb; public class ccc { private int month1,month2; public ccc(){ } public void setmonth1(int month1) { this.month1=month1; } public void setmonth2(int month2) { this.month2=month2; } public int getmonth1(){ return month1; } public int getmonth2(){ return month2; } public void lmonth(){ System.out.println("上月电表读数"+this.month1+"今年电费:"+month1*12*0.5); } public void tmonth(){ System.out.println("本月电表读数"+this.month2+"今年电费:"+month2*12*0.5); } }
package bbb; public class Testccc { public static void main(String[]args){ // System.out.println("上月电表读数为:"); ccc c1=new ccc(); c1.setmonth1(1000); // System.out.println("本月电表读数为:"); ccc c2=new ccc(); c2.setmonth2(1200); c1.lmonth(); c2.tmonth(); } }
以上是关于电费管理类的主要内容,如果未能解决你的问题,请参考以下文章