diff options
Diffstat (limited to 'C++/RestaurantBill')
-rw-r--r-- | C++/RestaurantBill/RestaurantBill.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/C++/RestaurantBill/RestaurantBill.cpp b/C++/RestaurantBill/RestaurantBill.cpp new file mode 100644 index 0000000..cdcc40d --- /dev/null +++ b/C++/RestaurantBill/RestaurantBill.cpp @@ -0,0 +1,55 @@ +// Name: msglm +// Introduction: Restaurant Bill Calculator +// Description: Calculates Food Bill Plus Tip and Tax. + + +#include <iostream> +using namespace std; +int main() { + + float foodBill; + char tipChoice; + + cout << "How much did your meal cost?: "; + cin >> foodBill; + + cout << "A. 10% - " << foodBill+(foodBill*0.10) << endl; + cout << "B. 15% - " << foodBill+(foodBill*0.15) << endl; + cout << "C. 20% - " << foodBill+(foodBill*0.20) << endl; + cout << "Select a Letter (case-sensitive) to pick your tipping amount: "; + cin >> tipChoice; + + switch(tipChoice){ + case 'A': + cout << "You Owe: \n" + << "Before Tax and Before Tip: " << foodBill << endl + << "After Tax and Before Tip: " << foodBill+(foodBill*0.095) << endl + << "After Tax and After Tip: " << foodBill+(foodBill*0.10) + (foodBill*0.095) << endl; + break; + case 'B': + cout << "You Owe: \n" + << "Before Tax and Before Tip: " << foodBill << endl + << "After Tax and Before Tip: " << foodBill+(foodBill*0.095) << endl + << "After Tax and After Tip: " << foodBill+(foodBill*0.15) + (foodBill*0.095) << endl; + break; + case 'C': + cout << "You Owe: \n" + << "Before Tax and Before Tip: " << foodBill << endl + << "After Tax and Before Tip: " << foodBill+(foodBill*0.095) << endl + << "After Tax and After Tip: " << foodBill+(foodBill*0.20) + (foodBill*0.095) << endl; + break; + default: + cout << "You didn't input the right letter. Remember, the letters were capitalized."; + return 1; + + } + return 0; + +} + +/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + |