C++ Programming Blog

 
 
 

Image

/*An electricity board charges the following rates to domestic
users to discourage large consumption of energy:
    For the first 100 units - 40p per unit
   For next 200 units        - 50p per unit
   Beyond 300 units            - 60p per unit
All users are charged a minimum of Rs.500.  If the total cost is
more than Rs.250.00 then an additional surcharge of 15% is added.
    Write a program to read the names of users and number of units
consumed and print out the charges with names.*/

#include <iostream.h>
#include <conio.h>
void main()
{
clrscr();
cout<<\"\\n\\n\\n\\tElectricity Board Charges\\n\";
cout<<\"\\n\\tTo Discourage Large Consumption of energy\\n\\n\";



char name[20];
cout<<\"\\n\\nEnter USER name :-\";
cin>>name;

cout<<\"\\n\\nEnter Number of Units Consumed:-\";
float unit;
cin>>unit;

//MANIPULATION
float tc;
if(unit<=100)
    tc=unit*0.40;
else if(unit<=300)
    tc=unit*0.50;
else
    tc=unit*0.60;


float surchase=0;
if(tc>250)
    surchase=tc*0.15;

float total_cost;
total_cost = 500 + surchase + tc;

cout<<\"\\n\\nYOUR BILL AMOUNT IS \"<<total_cost;

getch();
}

    Related Post:
  1. Program that reads marks of a students and computes and displays grade

  2. Program to read marks of 10 students for 4 subjects and compute and display total marks and status of each student

  3. Program to perform sorting of linklist

  4. Program to convert infix expression to postfix / suffix expression using paranthesize

  5. Program to illustrate the use of call-by-refrence method in functions

  6. Program that provides an example of This pointer

  7. Program to illustrate the implementation of arrays as a Linear Queue ( in graphics )

  8. Program to construct Newtons Backward Difference Interpolation Formula from the given distinct equally spaced data points

  9. Program to construct Natural Cubic Spline Interpolant from the given data

  10. PROGRAM TO IMPLEMENT RECURSIVE DESCENT PARSER

  11. Program that computes the n_th term of the fibonacci series using recursion

  12. Program of maintaining banking account information system using inheritance

  13. Menu driven Bank Application Project

  14. Program that provides an example of passing objects to function using call by reference method

  15. Program to computes the n_th term of the fibonacci series using Dynamic Programming Technique

  16. Program to illusrate the use of stream insertion and extraction operators

  17. Program of traversing a binary tree in inorder iteratively

  18. Program to illustrate the binary operator(+) overloading without creating a new object

  19. Program to implement Add and Subtract functions on Big Number Class

  20. Program to read a Non-Linear equation in one variable, then evaluate it using Secant Method and display its kD accurate root

 
 
Didn't find what you were looking for? Find more on Program for electricity board charges calculation