Posted By

Dium on 03/31/14


Tagged


Versions (?)

midterm 9


 / Published in: C++
 

asdf

  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int customerStatus;
  6. double numberofUnits, totalCost;
  7.  
  8. cout << "Enter customer status (Wholesaler = 1, Retailer = 2): ";
  9. cin >> customerStatus;
  10. cout << "Enter number of units: ";
  11. cin >> numberofUnits;
  12.  
  13. if (customerStatus == 1)
  14. {
  15. if (numberofUnits <= 10)
  16. {
  17. totalCost = numberofUnits * 65;
  18. cout << "Total: $" << totalCost << endl;
  19. }
  20. else
  21. {
  22. totalCost = numberofUnits * 55;
  23. cout << "Total: $" << totalCost << endl;
  24. }
  25.  
  26. }
  27.  
  28. if (customerStatus == 2)
  29. {
  30. if (numberofUnits <= 14)
  31. {
  32. totalCost = numberofUnits * 75;
  33. cout << "Total: $" << totalCost << endl;
  34. }
  35.  
  36. else if (numberofUnits >= 15 && numberofUnits <= 20)
  37. {
  38. totalCost = numberofUnits * 70;
  39. cout << "Total: $" << totalCost << endl;
  40. }
  41.  
  42. else if (numberofUnits >= 21)
  43. {
  44. totalCost = numberofUnits * 65;
  45. cout << "Total: $" << totalCost << endl;
  46. }
  47. }
  48.  
  49. system("pause");
  50. return 0;
  51. }

Report this snippet  

You need to login to post a comment.