Page 134 - CA_Blue( J )_Class10
P. 134
21 st
Some More Programs Century #Coding & Computational Thinking
Skills
ABC Electricity Board generates monthly bill depending on the previous month and current month
Program 1
meter readings. The amount generated depends on the following criteria:
Units consumed in a month Rate
--------------------------------------- -------------------
Up to 150 units Rs. 4.25 / Unit
Next 200 units Rs. 5.50 / Unit
Next 250 units Rs. 6.75 / Unit
Above 600 units Rs. 8 / Unit
The bill contains Month, Name of the Consumer, Previous and Current Meter Readings, and the
calculated amount to be paid by the consumer in the following format:
Bill for ABC Electricity Board
Month of _____________
Name of Consumer ___________
Previous Meter Reading ___________
Current Meter Reading ____________
Bill Amount ____________
1 import java.util.*;
2 class ABCElectricitybill
3 {
4 public static void main()
5 {
6 Scanner sc = new Scanner(System.in);
7 int prv,cur,unit;
8 String month,name;
9 double amt=0.0;
10 System.out.print("Enter Month Name : ");
11 month=sc.next();
12 System.out.print("Enter name of the consumer : ");
13 name=sc.next();
14 System.out.print("Enter previous meter reading : ");
15 prv=sc.nextInt();
16 System.out.print("Enter current meter reading : ");
17 cur=sc.nextInt();
18 unit=cur-prv;
19 if(unit<=150)
20 amt = unit * 4.25;
21 else if(unit<=350)
132132 Touchpad Computer Applications-X

