fork download
  1. // Marvyn De La Torre CS1A Chapter 3, P.143, #2
  2.  
  3. /*************************************************************
  4. // Calculate Stadium Ticket Income
  5. //
  6. // This program displays the total income generated from ticket
  7. // sales for the three seating classes at a stadium.
  8. //
  9. // Input:
  10. // Number of Class A tickets sold
  11. // Number of Class B tickets sold
  12. // Number of Class C tickets sold
  13. //
  14. // Output:
  15. // Total income from ticket sales
  16. *************************************************************/
  17.  
  18. #include <iostream>
  19. #include <iomanip>
  20. using namespace std;
  21.  
  22. int main()
  23. {
  24. double classA;
  25. double classB;
  26. double classC;
  27. double total;
  28.  
  29. cin >> classA;
  30. cin >> classB;
  31. cin >> classC;
  32.  
  33. total = (classA * 15) + (classB * 12) + (classC * 9);
  34.  
  35. cout << fixed << showpoint << setprecision(2);
  36. cout << "The total income is $" << total;
  37.  
  38. return 0;
  39. }
Success #stdin #stdout 0s 5312KB
stdin
10
10
10
stdout
The total income is $360.00