Advertisement
Guest User

Untitled

a guest
Jan 25th, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. #include<fstream>
  2. #include <iostream>
  3. #include <string>
  4. using namespace std;
  5. /*
  6. Name: Alberto Pereira Total Points: 10
  7. Due Date: 2/4/2013
  8. Course: C0P3014
  9. Assignment: Assignment 1
  10. Professor: Dr. Lofton Bullard
  11. Description:This program takes inputs from the user and calculates the amount a user
  12. is charged for making a phone call */
  13.  
  14. int main()
  15. {
  16. string cell_num;
  17. int relays;
  18. int call_time;
  19. float net_cost = 0.00;
  20. float call_tax = 0.00;
  21. float total_cost = 0.00;
  22. float tax_rate = 0.00;
  23.  
  24.  
  25.  
  26. /*Gets the phone number, call time and number of relays made by the user
  27. for the phone call */
  28.  
  29. cout << "Please enter your cell phone number here: \n";
  30. cin >> cell_num;
  31. cout << "Please enter the length of your call in minutes here: \n";
  32. cin >> call_time;
  33. cout << "Please enter the number of relays here: \n";
  34. cin >> relays;
  35.  
  36. /* calculates the take rate for the phone call made by the user */
  37.  
  38. if(relays>=0 && relays<=5)
  39. {
  40. tax_rate=1;
  41. }
  42.  
  43. else if(relays>=6 && relays<=11)
  44. {
  45. tax_rate=3;
  46. }
  47. else if(relays>=12 && relays<=20)
  48. {
  49. tax_rate=5;
  50. }
  51. else if(relays>=21 && relays<=50)
  52. {
  53. tax_rate=8;
  54. }
  55. else if(relays>50)
  56. {
  57. tax_rate=12;
  58. }
  59.  
  60. /* calculates the net cose, the tax for the call and the total cost
  61. of the phone call made by the user. */
  62.  
  63. net_cost = relays/50.0 * 0.40 * call_time;
  64. call_tax = net_cost* tax_rate/100;
  65. total_cost = net_cost + call_tax;
  66.  
  67. /* outputs */
  68.  
  69. cout << "Cell phone number: " << cell_num << "\n";
  70. cout << "Number of relays stations for the call: " << relays << "\n";
  71. cout << "Minutes used: " << call_time << " minutes\n";
  72. cout << "The net cost of the call is: " << net_cost << "\n";
  73. cout << "The tax of the call is: " << call_tax << "\n";
  74. cout << "The total cost of the call is: " << total_cost << "\n";
  75.  
  76. return 0;
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement