write a program in Java to enter unit consume and calculate electricity charge based on the following condition :-
first unit 100 unit is rupees 5 per unit
50 unit is rupees 7 per unit
>150 unit is equal to 8 rupees per unit
Answers
Answered by
1
Answer:
Given an integer U denoting the amount of KWh units of electricity consumed, the task is to calculate the electricity bill with the help of the below charges:
1 to 100 units – 
100 to 200 units – 
200 to 300 units – 
above 300 units – 
Examples:
Input: U = 250
Output: 3500
Explanation:
Charge for the first 100 units – 10*100 = 1000
Charge for the 100 to 200 units – 15*100 = 1500
Charge for the 200 to 250 units – 20*50 = 1000
Total Electricity Bill = 1000 + 1500 + 1000 = 3500
Input: U = 95
Output: 950
Explanation:
Charge for the first 100 units – 10*95 = 950
Total Electricity Bill = 950
Similar questions
English,
4 months ago
Geography,
4 months ago
Math,
9 months ago
Political Science,
1 year ago
Hindi,
1 year ago