summaryrefslogtreecommitdiffstats
path: root/C++/RestaurantBill/RestaurantBill.cpp
blob: cdcc40d11e77f7c6cceaf75f83e4243ba87b843b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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/>.
 */