Server IP : 172.16.15.8 / Your IP : 3.15.211.71 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/kmmowery/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
//-------------------------------------------------------------------------- // // // Written By: Kieara Mowery // Due: October 8th // Purpose: To write a program using if..else to 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-------------------- #include <iostream> #include <iomanip> using namespace std; int main () { float purchase, // amount of purchase savings, // amount saved with the discount amountowed; // amount owed after savings //----------Input Values------------------ cout << "Enter the amount of your purchase -> "; cin >> purchase; //------------Calculations-------------- if ( purchase <= 50 ) { savings = purchase * .10; amountowed = purchase - .10; cout << " You have registered to win a free electric knife! "; } else if ( purchase > 50 && purchase < 250 ) { savings = purchase * .15 + 5.00; amountowed = ( purchase - .15 - 5.00 ); cout << " You have registered to win a blender! " ; } else ( purchase < 250 ) } savings = purchase * .20; amountowed = ( purchase * .20 ) - 35; cout << " You have registered to win a toaster oven! "; } //--------Display Calculations----------------- cout << setprecision(2) << fixed; cout << " You Purchased " << purchase << endl; cout << " You owe " << amountowed << endl; cout << " You saved " << savings << endl; return 0; }