From 9d53d8857eaa1c9405894a88ca75bc4657e42f35 Mon Sep 17 00:00:00 2001 From: msglm Date: Sat, 14 Jan 2023 05:31:48 -0600 Subject: Inital Commit --- C++/RestaurantBill/RestaurantBill.cpp | 55 +++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 C++/RestaurantBill/RestaurantBill.cpp (limited to 'C++/RestaurantBill') 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 +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 . + */ + -- cgit v1.2.3