Write a program to store consumer number and number of calls and calculate telephone bill accordin to condition

Take Customer number and no. of calls from user.
Calculate Bill as follows..
If number of calls <=100 : Free
Number of calls >=200 <=300 : 1.40 per call on over 100
Number of calls >=300 <=400 : 140+1.60 per call on over 200
Number of calls >=300 <=400 : 300+1.80 per call on over 300
Number of calls >=400 : 480+2.10 per call on over 400
And Fixed monthly rental: RS 100
And generate bill.

Select To use this code as it is.. select and copy paste this code into code.cpp file :)



  1. #include <iostream.h>
  2. #include <conio.h>
  3. void main()
  4. {
  5. clrscr();
  6. float id,qty,tot,amt;
  7. cout<<"Enter Customer No.: ";
  8. cin>>id;
  9. cout<<"Please Enter No. of Calls: ";
  10. cin>>qty;
  11. if(qty<=100)
  12. amt=0;
  13. else if(qty>100&&qty<=200)
  14. amt=1.40*(qty-100);
  15. //Coding by: Snehil Khanor
  16. //http://WapCPP.blogspot.com
  17. else if(qty>200&&qty<=300)
  18. amt=140+1.60*(qty-200);
  19. else if(qty>300&&qty<=400)
  20. amt=300+1.80*(qty-300);
  21. else
  22. amt=480+2.10*(qty-400);
  23. tot=100+amt;
  24. cout<<"\n\n\nCustomer NO.: "<<id<<"\nNo. of Calls: "<<qty<<"\nMonthly Rental:
  25. INR 100\nTotal amt: INR "<<tot;
  26. getch();
  27. }

Check out this stream