-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathProblemStatement
More file actions
25 lines (21 loc) · 1.19 KB
/
ProblemStatement
File metadata and controls
25 lines (21 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Problem Statement:
Develop a Java application to generate Electricity bill. Create a package billings and Create a class ElectricityBill with the following
members: Consumer no., consumer name, previous month reading, current month reading, type
of EB connection(i.e domestic or commercial). Declare constructors to pass the initial attributes.
Declare and define the following member functions
getData() - to get attributes from the user
printData() - to print the data
computeBillAmount() - to calculate and print the bill amount in appropriate format
Compute the bill amount using the following tariff.
If the type of the EB connection is domestic, calculate the amount to be paid as follows:
First 100 units - Rs. 1 per unit
101-200 units - Rs. 2.50 per unit
201 -500 units - Rs. 4 per unit
>501 units - Rs. 6 per unit
If the type of the EB connection is commercial, calculate the amount to be paid as follows:
First 100 units - Rs. 2 per unit
101-200 units - Rs. 4.50 per unit
201 -500 units - Rs. 6 per unit
> 501 units - Rs. 7 per unit
Create a class Calculation1 with main function. Create the object of EBill class, get the data
and display the bill amount by calling computeBillAmount() function.