Guest User

Untitled

a guest
Dec 7th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. //Assignment #07: Program to compute discount
  2. #include<iostream>
  3. #include<iomanip>
  4. using namespace std;
  5.  
  6. int main ()
  7. {
  8. double ListPrice,Discount,SalePrice;
  9.  
  10. cout << "Name: Anthony Hargraves\n";
  11. cout << "Assignment #7: \"Program to compute discount\"\n";
  12. cout << "\n\n\n";
  13.  
  14. //User Enters List Price of Coat
  15. cout << "Enter the list price of the coat you purchased: $";
  16. cin >> ListPrice;
  17. cout << endl;
  18. cout << "\n\n\n";
  19.  
  20. //Calculate Discount Based on List Price
  21. if (ListPrice>399)
  22. Discount = 0.15 * ListPrice;
  23. else
  24. Discount = 0.10 * ListPrice;
  25.  
  26. //Calculate Sale Price
  27. SalePrice = ListPrice - Discount;
  28.  
  29. //Display Results to User
  30. cout << "---------- Your Receipt ----------\n\n";
  31. cout << "Your total is:\t$" << setprecision(2) << fixed << SalePrice << "\n";
  32. cout << endl;
  33. cout << "You saved:\t$" << Discount << "\n";
  34. cout << "\n\n\n";
  35.  
  36. system("pause");
  37. return 0;
  38.  
  39. }
  40.  
  41. /* FINAL PROGRAM OUTPUT
  42.  
  43. Name: Anthony Hargraves
  44. Assignment #7: "Program to compute discount"
  45.  
  46.  
  47.  
  48. Enter the list price of the coat you purchased: $409.99
  49.  
  50.  
  51.  
  52.  
  53. ---------- Your Receipt ----------
  54.  
  55. Your total is: $348.49
  56.  
  57. You saved: $61.50
  58.  
  59.  
  60.  
  61. Press any key to continue . . .
  62. */
Add Comment
Please, Sign In to add comment