I need it in half an hour, please.
Write a "C" program to develop a
HOUSE BILL REPORT application. The purpose of this program is to
calculate the total bills for each house owner based on electric
bill and water bill as shown in Figure 1. The
bill calculation for electric bill and water bill are given
in Figure 2 and Figure
3, respectively. The total bills are the sum of electric
bill and water bill. Figure 4 is the
calculation for electric and water discount.
Meanwhile Figure 5 is a part
of main() function that you must
use in your program.
Enter House Owner Name: A
Enter House Address: ABC, Earth
Enter Current Unit for Electric: 500
Enter Previous Unit for Electric: 200
Enter Current Unit for Water: 50
Enter Previous Unit for Water: 20
Enter House Owner Name: B
Enter House Address: BCD, Earth
Enter Current Unit for Electric: 200
Enter Previous Unit for Electric: 50
Enter Current Unit for Water: 20
Enter Previous Unit for Water: 10
Enter House Owner Name: C
Enter House Address: CDe, Earth
Enter Current Unit for Electric: 30
Enter Previous Unit for Electric: 10
Enter Current Unit for Water: 10
Enter Previous Unit for Water: 5
HOUSE BILL REPORT
House Owner Name : A
House Address : ABC, Earth
Electric bill : SS120.00
Water bill : SS30.00
Total bills : SS150.00
Total bills after discount: SS135.00
House Owner Name : B
House Address : BCD Earth
Electric bill : SS30.00
Water bill : SS5.00
Total bills : sS35.00
Total bills after discount: SS28.00
House Owner Name : C
House Address :CDE, Earth
Electric bill : SS2.00
Water bill : SS2.50
Total bills : SS4.50
Total bills after discount: SS3.60
Figure 1
Calculation for electric bill.
unit used = current unit – previous unit
If unit used is less than 100 unit, the electric bill = unit
used x 0.10
If unit used is higher or equal to 100 unit but less than 200
unit, the electric bill = unit used x 0.20
Others, the electric bill = unit used x 0.40
Figure 2
Calculation for water bill.
unit used = current unit – previous unit
If unit used is less than 20 unit, the water bill = unit used x
0.50
Others, the water bill = unit used x 1.00
Figure 3
Calculation for discount.
Electric bill: 20% discount if electric bill is less than 100.
Others, 10% discount.
Water bill: 20% discount if water bill is less than 10. Others,
10% discount.
Figure 4
for(int i=0;i<3;i++)
{
house=getInfo();
house=calculateBill(house);
house.totalBill=calculateTotalBillsAfterDiscount(house);
}
display(house);
Figure 5
Based on Figure
1 until Figure 5, answer the
following questions
(11 Marks)
display() to display the house bill report as shown in
Figure 1.
I need it in half an hour, please. Write a "C" program to develop a HOUSE BILL REPORT application. The purpose of this p
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am