fork download
  1. //DAVID MORALES CSC5 Chapter 3, P. 143, #2
  2. /*
  3. ****************************************************************
  4. *
  5. * Stadium Seating
  6. *_______________________________________________________________
  7. * This program will calculate the total income generated from
  8. * ticket sales for Class A, Class B, and Class C seats.
  9. *
  10. * Class A seats cost $15
  11. * Class B seats cost $12
  12. * Class C seats cost $9
  13. *_______________________________________________________________
  14. * INPUT
  15. * Number of Class A tickets sold
  16. * Number of Class B tickets sold
  17. * Number of Class C tickets sold
  18. *
  19. * OUTPUT
  20. * Total income generated from ticket sales
  21. *
  22. ****************************************************************
  23. */
  24.  
  25. #include <iostream>
  26. #include <iomanip>
  27. using namespace std;
  28.  
  29. int main()
  30. {
  31. int classA, classB, classC;
  32. double total;
  33.  
  34. // INPUT
  35. cout << " STADIUM SEATING TICKET SALES\n\n";
  36.  
  37. cout << "Enter the number of Class A tickets sold (0 or more): ";
  38. cin >> classA;
  39.  
  40. cout << "Enter the number of Class B tickets sold (0 or more): ";
  41. cin >> classB;
  42.  
  43. cout << "Enter the number of Class C tickets sold (0 or more): ";
  44. cin >> classC;
  45.  
  46. // PROCESS
  47. total = (classA * 15) + (classB * 12) + (classC * 9);
  48.  
  49. // OUTPUT
  50. cout << "\n\n SALES SUMMARY\n\n";
  51.  
  52. cout << "Class A Tickets: " << classA << " ($15 each)\n";
  53. cout << "Class B Tickets: " << classB << " ($12 each)\n";
  54. cout << "Class C Tickets: " << classC << " ($9 each)\n";
  55.  
  56. cout << "\nTotal Income: $" << fixed << setprecision(2)
  57. << total << endl;
  58.  
  59. return 0;
  60. }
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
       STADIUM SEATING TICKET SALES

Enter the number of Class A tickets sold (0 or more): Enter the number of Class B tickets sold (0 or more): Enter the number of Class C tickets sold (0 or more): 

             SALES SUMMARY

Class A Tickets: 22001  ($15 each)
Class B Tickets: 673463632  ($12 each)
Class C Tickets: 32764   ($9 each)

Total Income: $-507746117.00