summaryrefslogtreecommitdiffstats
path: root/C++/SummerJob/SummerJob.cpp
blob: e8459d5736bfbc5d979a16641f68e4e87bda49cd (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
56
// Name: msglm
// Introduction: Summer Job Wage Calculator
// Description: a program that calculates a weekly wage, based on an hourly payrate and how many hours were worked; then calculates amounts for various categories of spending, along with how much of the weekly pay is leftover.


#include <iostream>
#include <string>
using namespace std;
int main() {

    string name;
    float payRate; 
    float hours;
    float WeeklyWage;

    //Accept input via cin for hourly wages, pay rate, and name

    cout << "What is your name?: ";
    getline(cin, name);

    cout << "What is your payrate (per hour)?: ";
    cin >> payRate;

    cout << "How many hours have you worked?: ";
    cin >> hours;

    //Multiply the input to create the WeeklyWage variable 
    //Possible memory optimization here by removing the WeeklyWage variable, but at the cost of CPU cycles.
    WeeklyWage = hours*payRate;

    //Print the User’s name
    cout << "Name: " << name << endl;


    //Print the Wage
    cout << "Wages: " << WeeklyWage << "$" << endl;

    //have a bunch of cout statements that do all the math
    // I.e : cout << “Tax: “ << WeeklyWage*0.15

    cout << "Tax: $"  << WeeklyWage*0.15 << endl;
    cout << "Shopping: $" << WeeklyWage*0.20 << endl;
    cout << "Entertainment: $" << WeeklyWage*0.10 << endl;
    cout << "Savings: $" << WeeklyWage*0.25 << endl;
    cout << "Remainder: $" << WeeklyWage*0.30 << endl;

    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/>.
 */