From 9d53d8857eaa1c9405894a88ca75bc4657e42f35 Mon Sep 17 00:00:00 2001 From: msglm Date: Sat, 14 Jan 2023 05:31:48 -0600 Subject: Inital Commit --- C++/SummerJob/SummerJob.cpp | 56 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 C++/SummerJob/SummerJob.cpp (limited to 'C++/SummerJob/SummerJob.cpp') diff --git a/C++/SummerJob/SummerJob.cpp b/C++/SummerJob/SummerJob.cpp new file mode 100644 index 0000000..e8459d5 --- /dev/null +++ b/C++/SummerJob/SummerJob.cpp @@ -0,0 +1,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 +#include +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 . + */ + -- cgit v1.2.3