fork download
  1. //Faith Tjia CSC5 Chapter 3, P. 143, #2
  2. //
  3. /*******************************************************************************
  4. * COMPUTE STADIUM INCOME
  5. * ______________________________________________________________________________
  6. * This program will store the costs of tickets, ask for the amount of tickets
  7. * for each class of seats sold, then computes the income generated from ticket
  8. * sales.
  9. *
  10. * FORMUlA USED
  11. * Income = amount of tickets * cost of ticket
  12. * ______________________________________________________________________________
  13. * INPUT
  14. * classA : cost of Class A seats
  15. * ticketA : amount of tickets Class A sold
  16. * classB : cost of Class B seats
  17. * ticketB : amount of tickets Class B sold
  18. * classC : cost of Class C seats
  19. * ticketC : amount of tickets Class C sold
  20. *
  21. * OUTPUT
  22. * Income : income generated from ticket sales
  23. *
  24. *******************************************************************************/
  25. #include <iostream>
  26. #include <iomanip>
  27. using namespace std;
  28.  
  29. int main()
  30. {
  31. int classA; //INPUT - cost of class A seats
  32. int ticketA; //INPUT - amount of tickets Class A sold
  33. int classB; //INPUT - cost of Class B seats
  34. int ticketB; //INPUT - amount of tickets Class B sold
  35. int classC; //INPUT - cost of Class C seats
  36. int ticketC; //INPUT - amount of tickets Class C sold
  37. float Income; //OUTPUT - income generated from ticket sales
  38. //
  39. // Initialize Program Variables
  40. classA = 15;
  41. classB = 12;
  42. classC = 9;
  43. cout << "Enter the amount of Class A tickets sold: ";
  44. cin >> ticketA;
  45. cout << ticketA << endl;
  46. cout << "Enter the amount of Class B tickets sold: ";
  47. cin >> ticketB;
  48. cout << ticketB << endl;
  49. cout << "Enter the amount of Class C: ";
  50. cin >> ticketC;
  51. cout << ticketC << endl;
  52. //
  53. // Calculate The Income
  54. Income = (classA * ticketA) + (classB + ticketB) + (classC + ticketC);
  55. //
  56. // Display The Income
  57. cout << "The income of the stadium is $" << setprecision(2) << fixed
  58. << Income << endl;
  59. return 0;
  60. }
Success #stdin #stdout 0.01s 5272KB
stdin
Standard input is empty
stdout
Enter the amount of Class A tickets sold:	 21986
Enter the amount of Class B tickets sold: 2141861616
Enter the amount of Class C: 32765
The income of the stadium is $2142224128.00