google.com, pub-6167773875660516, DIRECT, f08c47fec0942fa0 Write a program to create electricity bill - 2nd puc computer science

Write a program to create electricity bill

 /* Write a program to input the number of units of electricity consumed

in a house and calculate the final amount using nested-if statement. use

the following data for calculation

Units consumed Cost

<30         Rs 3.50/unit

>=30 and <50 Rs 4.25/unit

>=50 and <100 Rs 5.25/unit

>100 Rs 5.85/unit */

#include<iostream.h>

#include<conio.h>

void main()

{

int oldread,newread,units;

float minamt,vat,amt,netamt;

clrscr();

cout<<"Enter the old reading: ";

cin>>oldread;

cout<<"Enter the new reading: ";

cin>>newread;

cout<<"Enter the minimum amount: ";

cin>>minamt;

units=newread-oldread;

if(units<30)

amt=units*3.50;

else if(units<50)

amt=(29*3.50)+(units-29)*4.25;

else if(units<100)

amt=(29*3.50)+(20*4.25)+(units-49)*5.25;

else

amt=(29*3.50)+(20*4.25)+(50*5.25)+(units-99)*5.85;

vat=12.5/100;

netamt=amt+(amt*vat)+minamt;

cout<<"Final amount="<<netamt;

getch();

}

Write a program to create electricity bill Write a program to create electricity bill Reviewed by Vision Academy on February 27, 2022 Rating: 5

No comments:

CheckOut

Powered by Blogger.