System.out.println("Customer Number--"+customerNo);

PROGRAM 1: /*calculate electricity bill Program to compute the electricity bill of a person under the following units consumed for the first 100 unit...
Author: Harvey Gardner
1 downloads 1 Views 926KB Size
PROGRAM 1:

/*calculate electricity bill Program to compute the electricity bill of a person under the following units consumed for the first 100 units: Rs. 1.20 per unit For the next 200 units- Rs. 2 per unit For the next 300 units-Rs. 3 per unit */

class ElectricityBill { private int customerNo; private String name; private int units; void setData(int num, String cname, int noUnits) { customerNo= num; name= cname; units= noUnits; } void show() { System.out.println("Customer Number--"+customerNo); System.out.println("Customer Name---"+units); System.out.println("Units Consumed---"+name);

} double billCalculate() { double bill; if(units