else if(usage>200 && usage<=300){//1 to 300 electricityBil1 - 200*21.80;//21.80 for first 200 units electricityBill - electricityBill + (usage-200)*33.48;//33.40 for next upto 300 units } else if(usage> 300 && usage<-60e){//1 to 600 electricityBill - 200*21.8e;//21.80 for first 200 units electricityBill - electricityBili + 10e*33.48;//33.40 for next upto 100 units electricityBill-electricityBill + (usage-300)*51.60;//for next 300 units else if(usage> 600 && usage<-9ee){//1 to 900 electricityBil1 - 200 21.80;//21.80 for first 200 units electricityBill - electricityBill + 100*33.40;//33.40 for next upto 100 units electricityBill-electricityBill + 300*51.68;//for next 300 units electricityBill - electricityBill+ (usage-600)*54.60;//for next 300 else{ electricityBill electricityBill - electricityBill + 100*33.40;//33.40 for next upto 100 units electricityBill-electricityBili + 300*51.60;//for next 300 units electricityBill - electricityBill+ (300)*54.68;//for next 300 electricityBill - electricityBill + (usage-900)*57.10;//for above 900 - 200*21.80;///21.80 for first 200 units return electricityBill;//return the bill int main() int readings[2];//array of size 2 readings[e] - inputoldReading();//index @ holds old reading readings[1] - inputCurrentReading();//index 1 holds current reading int usage - readings[1]-readings[@];//calculate the current and old reading double bill; bill - calculateBill(usage);//get the bill based on usage printf("Total bill for %d units usage is %.2f.", usage, bill); return e;
else if(usage>200 && usage<=300){//1 to 300 electricityBil1 - 200*21.80;//21.80 for first 200 units electricityBill - electricityBill + (usage-200)*33.48;//33.40 for next upto 300 units } else if(usage> 300 && usage<-60e){//1 to 600 electricityBill - 200*21.8e;//21.80 for first 200 units electricityBill - electricityBili + 10e*33.48;//33.40 for next upto 100 units electricityBill-electricityBill + (usage-300)*51.60;//for next 300 units else if(usage> 600 && usage<-9ee){//1 to 900 electricityBil1 - 200 21.80;//21.80 for first 200 units electricityBill - electricityBill + 100*33.40;//33.40 for next upto 100 units electricityBill-electricityBill + 300*51.68;//for next 300 units electricityBill - electricityBill+ (usage-600)*54.60;//for next 300 else{ electricityBill electricityBill - electricityBill + 100*33.40;//33.40 for next upto 100 units electricityBill-electricityBili + 300*51.60;//for next 300 units electricityBill - electricityBill+ (300)*54.68;//for next 300 electricityBill - electricityBill + (usage-900)*57.10;//for above 900 - 200*21.80;///21.80 for first 200 units return electricityBill;//return the bill int main() int readings[2];//array of size 2 readings[e] - inputoldReading();//index @ holds old reading readings[1] - inputCurrentReading();//index 1 holds current reading int usage - readings[1]-readings[@];//calculate the current and old reading double bill; bill - calculateBill(usage);//get the bill based on usage printf("Total bill for %d units usage is %.2f.", usage, bill); return e;
Chapter8: Advanced Method Concepts
Section: Chapter Questions
Problem 8RQ
Related questions
Question
Show the flowchart of this coding .
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 2 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
Recommended textbooks for you
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,