0

How do I set up Statutory Deduction in my c++ code

#include<iostream> using namespace std; int main() { float monday, tuesday, wednesday, thursday, friday, saturday, sunday, totalHours, payrate, basePay, overtime; int d, m, y; char slash_dummy; cout << "Enter pay rate: "; cin >> payrate; cout << endl; cout << "enter starting pay period date: "; cin >> m >>slash_dummy >> d >> slash_dummy >> y; cout << endl; cout << "pay week ends on thursday night at 12am" << " enter end of pay period date: "; cin >> m >> slash_dummy >> d >> slash_dummy >> y; cout << endl; cout << "Enter hours worked for friday: "; cin >> friday; cout << endl; cout << "Enter hours worked for saturday: "; cin >> saturday; cout << endl; cout << "Enter hours worked for sunday: "; cin >> sunday; cout << endl; cout << "Enter hours worked for monday: "; cin >> monday; cout << endl; cout << "Enter hours worked for tuesday: "; cin >> tuesday; cout << endl; cout << "Enter hours worked for wednesday: "; cin >> wednesday; cout << endl; cout << "Enter hours worked for thursday: "; cin >> thursday; cout << endl; totalHours = friday + saturday + sunday + monday + tuesday + wednesday + thursday; if (totalHours > 40) { overtime = (totalHours - 40)*1.5; basePay = (40 * payrate) + (overtime*payrate); } else { basePay= 40 * payrate; } cout<< "Your pay check without taxes should be: " << basePay << endl; cout << "total hours worked is: " << totalHours << endl; system("pause"); return 0; }

22nd Nov 2016, 3:36 PM
Reginald Wright
Reginald Wright  - avatar
4 Respostas
+ 1
please more explain about your question, i can not understand what you need.
27th Nov 2016, 1:31 PM
parisa
parisa - avatar
0
#include<iostream> #include<iomanip> using namespace std; int main() { double monday, tuesday, wednesday, thursday, friday, saturday, sunday, totalHours, payrate, basePay, overtime; int d, m, y; char slash_dummy; cout << "Enter pay rate: "; cin >> payrate; cout << endl; cout << "Enter starting pay period date: "; cin >> m >>slash_dummy >> d >> slash_dummy >> y; cout << endl; cout << "Pay week ends on thursday night at 12am " << "enter end of pay period date: "; cin >> m >> slash_dummy >> d >> slash_dummy >> y; cout << endl; cout << "Enter hours worked for friday: "; cin >> friday; cout << endl; cout << "Enter hours worked for saturday: "; cin >> saturday; cout << endl; cout << "Enter hours worked for sunday: "; cin >> sunday; cout << endl; cout << "Enter hours worked for monday: "; cin >> monday; cout << endl; cout << "Enter hours worked for tuesday: "; cin >> tuesday; cout << endl; cout << "Enter hours worked for wednesday: "; cin >> wednesday; cout << endl; cout << "Enter hours worked for thursday: "; cin >> thursday; cout << endl; totalHours = friday + saturday + sunday + monday + tuesday + wednesday + thursday; if (totalHours > 40) { overtime = (totalHours - 40)*1.5; basePay = (40 * payrate) + (overtime*payrate); } else { basePay= 40 * payrate; } double FICA = basePay*.062; double MedCare = basePay*.0145; double fedwitheld = basePay*.123; cout << fixed; cout << setprecision (2); cout<< "Your pay check without taxes should be: " << basePay << endl; cout << "total hours worked is: " << totalHours << endl; cout << "FICA deductions are 6.2% " << FICA << endl; cout << "Medicare dedcutions are 1.45% " << MedCare<< endl; cout << "federal Tax withheld is 12.35% " << fedwitheld << endl; cout << "Total deductions are " << FICA + MedCare+fedwitheld<< endl;
28th Nov 2016, 11:25 AM
Reginald Wright
Reginald Wright  - avatar
0
I was looking for net pay. these are the deductions like FICA ,medicare , federal withheld taxes. My code is 3 cent off on the federal Tax withheld. That's where I'm stuck now. This program will only work for people filing as single and must make over 20,000 a year. I need a better program for all filing persons. Example married people ext...
28th Nov 2016, 11:31 AM
Reginald Wright
Reginald Wright  - avatar
0
need help creating a code to rerun program. #include <iostream>; using namespace std; const int SENTINAL = 1; int main() { int input=0, cout << " Press 1 if you want to try agian, /n Press 2 if you're done!." << endl; cin >> input; while (input < 0 || input > 2) { cout << "that value is unacceptable.. try again:" cin >> input; } cout << "the value" << input << endl; if esle ( input ==1){ //stop program } if esle (input ==2){ //run program } }
27th Jun 2017, 6:37 AM
Reginald Wright
Reginald Wright  - avatar