49 An electricity board charge according to following rates
For the first 100 units Rs. 2 per unit,
For the next 200 units-Rs. 3 per unit,
Beyond 300 units Rs. 4 per unit.
All users are charged meter charge also, which is se. Write a
program in C++ to read the number of units consumed and print
out the charges
Answers
Answered by
0
Answer:
#include<iostream.h>
#include<conio.h>
class nips
{
public:
float a,b,c,d,e,f;
void input();
void process();
void show();
};
void nips::input()
{
cout<<"Enter five numbers=";
cin>>a>>b>>c>>d>>e;
}
void nips::process()
{
f=a+b+c+d+e;
}
void nips::show()
{
cout<<"Sum="<<f;
}
void main()
{
clrscr();
nips n1;
n1.input();
n1.process();
n1.show();
getch();
}
Output:
Enter five numbers=10, 20, 30, 40, 50
Sum=150
Explanation:
Similar questions