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 to estimate the value of Fourth Derivative of the function at the given points from the given data using Central Difference Formula of order 2

  2. Program for using enum

  3. Program to show find the maximum depth of a Binary Search Tree

  4. Program to illustrate the Bubble Sort

  5. Program to perform stack operations using array

  6. Program that displays result of students by compact if-else notation

  7. Program of converting class type to basic variable of type string using conversion function

  8. Program that reads a numbers , computes and displays the factorial of the given number using recursion

  9. Program that reads marks obtained by a student in a test of 100 marks and print pass if marks are greater than or equal to 50

  10. Program of Graphical Representation of Stack And Queue

  11. Program to count number of words, lines and characters in given string

  12. Program to show the implementation of Liang-Barsky Line Clipping Algorithm

  13. Program to estimate the Differential value of a given function using Runge-Kutta Methods

  14. Program pf parser 1

  15. Program to help Umar in this task. Represent each city by one lowercase character. Thus, you can have at most 26 different cities to visit....

  16. Program that takes input of vector elements and performs multiplication operation, and input/output (&gt;&gt;, &lt;&lt;) using operator overloading

  17. Program to evaluate series

  18. Program of vector class that perform different operations on vector

  19. Program of scaling about reference point

  20. Program to illusrate the use of friend functions

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