Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Assignment #07: Program to compute discount
- #include<iostream>
- #include<iomanip>
- using namespace std;
- int main ()
- {
- double ListPrice,Discount,SalePrice;
- cout << "Name: Anthony Hargraves\n";
- cout << "Assignment #7: \"Program to compute discount\"\n";
- cout << "\n\n\n";
- //User Enters List Price of Coat
- cout << "Enter the list price of the coat you purchased: $";
- cin >> ListPrice;
- cout << endl;
- cout << "\n\n\n";
- //Calculate Discount Based on List Price
- if (ListPrice>399)
- Discount = 0.15 * ListPrice;
- else
- Discount = 0.10 * ListPrice;
- //Calculate Sale Price
- SalePrice = ListPrice - Discount;
- //Display Results to User
- cout << "---------- Your Receipt ----------\n\n";
- cout << "Your total is:\t$" << setprecision(2) << fixed << SalePrice << "\n";
- cout << endl;
- cout << "You saved:\t$" << Discount << "\n";
- cout << "\n\n\n";
- system("pause");
- return 0;
- }
- /* FINAL PROGRAM OUTPUT
- Name: Anthony Hargraves
- Assignment #7: "Program to compute discount"
- Enter the list price of the coat you purchased: $409.99
- ---------- Your Receipt ----------
- Your total is: $348.49
- You saved: $61.50
- Press any key to continue . . .
- */
Add Comment
Please, Sign In to add comment