Advertisement
conception

lab3.cpp

Sep 18th, 2015
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. // Kariann Fenoglio
  2.  
  3. #include<iostream>
  4. #include<iomanip>
  5. #include "Company.h"
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10. double sales = 0;
  11. double product_sales[5] = { 0 };
  12. Company C;
  13. int product_no;
  14. cout << "Enter product number <1-5> <0 to stop>: ";
  15. cin >> product_no;
  16. cout << fixed << setprecision(2);
  17. while (product_no != 0)
  18. {
  19. int qty;
  20. cout << "Enter quantity sold: ";
  21. cin >> qty;
  22. sales = C.Calculate(product_no, qty);
  23. product_sales[product_no - 1] += sales;
  24. cout << "The sales for this product 1 is $" << sales << endl;
  25. cout << "\nEnter product number <1-5> <0 to stop>: ";
  26. cin >> product_no;
  27. }
  28. cout << "\nTotal Sales for the week:" << endl;
  29. cout << "-------------------------" << endl;
  30. for (int i = 0; i<5; i++)
  31. cout << "Product " << (i + 1) << ": $" << product_sales[i] << endl;
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement