Server IP : 172.16.15.8 / Your IP : 18.188.227.64 Web Server : Apache System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.2.24 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0705) : /home/cchansen/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
// ---------------------------------------------------------------------- // Test One Program - Dillard's Promotions // // Written by Caitlin Hansen // October 2008 // // Purpose: To calculate the proper savings, display both the savings and // the amount owed after savings, and to print the name of the gift for // which the customer is registered. //----------------------------------------------------------------------- // ------ Preprocessor Section ------ # include <iostream> # include <iomanip> # include <cmath> using namespace std; // -------- Main Function -------- int main () { // ------ Variables ------ float purchase, // amount of purchase savings, // amount saved with the discount amountsaved; // amount owed after savings // ----- Input Phase ----- cout << endl; cout << "Welcome to the Dillard's Promotion Calculator"; cout << endl; cout << "Please enter the amount of your purchase ---> "; cin >> purchase; // ---- Processing Phase ---- if(purchase < 50) { savings = purchase * 0.10; amountowed = purchase - savings; cout << "Congratulations, you've earned a free gift of an electric knife!"; } else if(purchase >= 50 && purchase <= 250) { savings = (purchase * 0.15) + 5.00; amountowed = purchase - savings; cout << "Congratulations, you've earned a free gift of a new blender!"; } else { savings = (purchase * 0.20) + 35.00; amountowed = purchase - savings; cout << "Congratulations, you've earned a free gift of a toaster oven!"; } // ----- Output Phase ----- cout << fixed; // force fixed point format for floats cout << " *~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*"; cout << endl; cout << " *~*~*~*~*~*~*~*~* Dillard's Promotions Calculator *~*~*~*~*~*~*~*~*"; cout << endl; cout << " *~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*"; cout << endl; cout << endl; cout << setprecision(2); // two decimal digit for floats cout << " Amount of Purchase: $ " << purchase; cout << endl; cout << endl; cout << " Amount Discounted: $ " << savings; cout << endl; cout << endl; cout << " Total Amount Owed: $ " << amountowed; cout << endl; cout << endl; return 0; }