fork download
  1. //Eesha Tangirala #CS1A Chapter 3, pg. 143, #2
  2.  
  3. //************************************************************************************
  4.  
  5. //Calculate seating sales income
  6.  
  7. //___________________________________________________________________________________
  8. //This program computes the amount of sales earned from the number of tickets sold in
  9. //three different price ranges.
  10. //___________________________________________________________________________________
  11.  
  12. //INPUT
  13. //Class A ticket count
  14. //Class B ticket count
  15. //Class C ticket count
  16.  
  17. //Output
  18. //Income earned from tickets sold
  19.  
  20. //***********************************************************************************
  21.  
  22. #include <iostream>
  23. #include <iomanip>
  24. using namespace std;
  25.  
  26. int main() {
  27. //Data Dictionary
  28. int classa;
  29. int classb;
  30. int classc;
  31.  
  32. //Inputs
  33. cout << "How many tickets were sold in class a?" << endl;
  34. cin >> classa;
  35. cout << "How many tickets were sold in class b?" << endl;
  36. cin >> classb;
  37. cout << "How many tickets were sold in class c?" << endl;
  38. cin >> classc;
  39.  
  40. //Calculate Income
  41. long income = (classa * 15) + (classb * 12) + (classc * 9);
  42.  
  43. //Display Output
  44. cout << "The amount earned from all ticket sales combined is " << fixed << setprecision(2)
  45. << income << endl;
  46.  
  47. return 0;
  48. }
Success #stdin #stdout 0s 5320KB
stdin
177 570 98
stdout
How many tickets were sold in class a?
How many tickets were sold in class b?
How many tickets were sold in class c?
The amount earned from all ticket sales combined is 10377