Advertisement
Limited_Ice

Untitled

Sep 16th, 2019
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.32 KB | None | 0 0
  1. // Lab 3 icecream.cpp
  2. // This progrma generates an ice cream sales report
  3. // David Hawkins
  4. // INCLUDE ANY NEEDED FILES HERE.
  5. #include <iostream>
  6. #include <string>
  7. #include <iomanip>
  8. using namespace std;
  9. int main()
  10. {
  11.     // DEFINE NAMED CONSTANTS HERE TO HOLD THE PRICES OF THE 3
  12.     float x = 1.49; //  price of a single scoop
  13.     float y = 2.49; //  price of a doublescoop
  14.     float z = 3.49; //  price of a triple scoop
  15.  
  16.     // SIZES OF ICE CREAM CONES. GIVE EACH ONE A DESCRIPTIVE
  17.     // NAME AND AN APPROPRIATE DATA TYPE.
  18.     int onescoop;
  19.     int twoscoop;
  20.     int threescoop;
  21.     int choice;
  22.     // DECLARE ALL NEEDED VARIABLES HERE. GIVE EACH ONE A DESCRIPTIVE
  23.     // NAME AND AN APPROPRIATE DATA TYPE.
  24.     // WRITE STATEMENTS HERE TO PROMPT FOR AND INPUT THE INFORMATION
  25.     // THE PROGRAM NEEDS TO GET FROM THE USER.
  26.     while (true)
  27.     {
  28.         cout << "Choose the Size do want to enter sale data for?\n1:  Single Scoop\n2:  Double Scoop\n3:  Triple Scoop\n4:  Print Report\n5:  Exit Program";
  29.         cin >> choice;
  30.  
  31.         if (choice == 1)
  32.         {
  33.             cout << "How many single scoop cones did you sell?  ";
  34.             cin >> onescoop;
  35.         }
  36.  
  37.         else if (choice == 2)
  38.         {
  39.             cout << "How many double scoop cones did you sell?  ";
  40.             cin >> twoscoop;
  41.         }
  42.  
  43.         else if (choice == 3)
  44.         {
  45.             cout << "How many triple scoop cones did you sell?  ";
  46.             cin >> threescoop;
  47.         }
  48.  
  49.         else if (choice == 4)
  50.         {
  51.             cout << "           Ice Cream Sales Report           \n";
  52.             cout << left << setw(28) << "Type of Cone" << right << setw(6) << "quant" << setw(10) << "Total Sales";
  53.             cout << "=================================";
  54.             cout << left << setw(30) << "Delightful cones" << right << setw(4) << onescoop << setw(10) << x * onescoop;
  55.             cout << left << setw(30) << "Double Delight cones" << right << setw(4) << twoscoop << setw(10) << y * twoscoop;
  56.             cout << left << setw(30) << "Triple Deleight conse" << right << setw(4) << threescoop << setw(10) << z * threescoop;
  57.             cout << left << setw(30) << "Total" << right << setw(4) << onescoop + twoscoop + threescoop << setw(10) << (x * onescoop) + (y * twoscoop) + (z * threescoop);
  58.             cout << endl;
  59.         }
  60.  
  61.         else if (choice == 5)
  62.         {
  63.             break;
  64.         }
  65.     }
  66.         // WRITE STATEMENTS HERE TO PERFORM ALL NEEDED COMPUTATIONS  
  67.         // AND ASSIGN THE RESULTS TO VARIABLES.
  68.  
  69.         // WRITE STATEMENTS HERE TO DISPLAY THE REQUESTED INFORMATION.
  70.  
  71.         return 0;
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement