I've already turned in the assignment because it was due. I know it wasn't done right but I didn't want a complete zero... Still wish I could figure this out though for my knowledge.
Justin9825 20 Light Poster
for(int j = 0; j< game.length;j++)
{
System.out.println(game[j].getName()+ " VS." + game[game.length-1-j].getName());
}
Justin9825 20 Light Poster
Now i'm getting this....
UNCC VS.USC
NCSU VS.USC
GT VS.USC
USC VS.USC
Justin9825 20 Light Poster
I actually don't get what this is doing... my output with what I posted above is:
UNCC VS.UGA
GT VS.UGA
GSU VS.UGA
UGA VS.UGA
It's using UGA for the last part of every statement and skipping NCSU,USC,UVA, and UNC?
I see my expression j++ is causing it to skip those teams... why?
Justin9825 20 Light Poster
I get what your saying and I'm looking through my book but I don't see how I separate the length-1 and incorporate my index into the statement so it's an legal expression. I tried separating with a "," and another "[]" but nothing seems to work.
Justin9825 20 Light Poster
Is this what your talking about.
System.out.println(game[j].getName()+ " VS." + game[game.length-1].getName());
I'm sorry i'm just not understanding what your saying. I know you must be frustrated but thank you so much for your help!
Justin9825 20 Light Poster
It won't let me do length-1... compiler error:
symbol : variable length
location: class Tournmanet
System.out.println(game[j].getName()+ " VS." + game[length-1].getName());
Justin9825 20 Light Poster
When i do change these two lines:
Teams[] game = new Teams[7];
System.out.println(game[j].getName()+ " VS." + game[j+6].getName());
I get what your saying now but I now get this error
"ArrayIndexOutOfBoundsException: 7"
Justin9825 20 Light Poster
What I need to understand is how to write the code so it will find the lowest and highest value in an array but somehow so it will continue to loop through until it reaches the end of the array or something?
Justin9825 20 Light Poster
So I got it to display all the teams like:
UNCC VS.UNCC
NCSU VS.NCSU
GT VS.GT
USC VS.USC
But I'm still not understand what I need to do so it creates the teams based on the amount of wins. Thanks a lot for your help as this is due at 9:00 pm tonight.
This is what I have now
import java.io.*;
import java.util.Scanner;
public class Tournmanet
{
public static void main(String [] args) throws IOException
{
File file = new File("Teams.txt");
Scanner input = new Scanner(file);
String w;
int wins;
String teamName;
int gameCounter=0;
Teams [] game = new Teams [4];
for (int i= 0; i < game.length; i++)
{
teamName = input.next();
w= input.next();
wins= Integer.parseInt(w);
game[i] = new Teams(teamName, wins);
}
for(int i= 0; i< game.length; i++)
{
if(i > game.length)
i++;;
System.out.println(game[i].getName()+ " VS." + game[i].getName());
}
}
}
class Teams
{
String teamName;
int wins;
public Teams()
{
}
public Teams (String teamName, int wins)
{
this.teamName = teamName;
this.wins = wins;
}
public String getName()
{
return teamName;
}
public int getWins()
{
return wins;
}
}
Justin9825 20 Light Poster
Sorry I'm a little lost about what you just said. This is my first class in java.
Justin9825 20 Light Poster
I now get this with just one loop.
NCSU VS.UNCC
GT VS.NCSU
USC VS.GT
This is my loop now btw:
for(int j= 0; j< game.length-1; j++)
{
if(j > game.length)
j++;
System.out.println(game[j+1].getName()+ " VS." + game[j].getName());
}
Justin9825 20 Light Poster
I'm need to set up teams based on how many wins the team has inside this text file :
UNCC 30
NCSU 28
GT 25
USC 20
GSU 19
UVA 15
UGA 2
UNC 1
For example the output of the program should be:
UNCC VS UNC
NCSU VS UGA
GT VS UVA
USC VS GSU
This is my code:
import java.io.*;
import java.util.Scanner;
public class Tournmanet
{
public static void main(String [] args) throws IOException
{
File file = new File("Teams.txt");
Scanner input = new Scanner(file);
String w;
int wins;
String teamName;
int gameCounter=0;
Teams [] game = new Teams [8];
for (int i= 0; i < game.length; i++)
{
teamName = input.next();
w= input.next();
wins= Integer.parseInt(w);
game[i] = new Teams(teamName, wins);
}
for (int i = 0; i < game.length-1; i+=2)
{
for(int j= 0; j< game.length; j+=2)
{
if(i > game.length)
j--;
System.out.println(game[i+1].getName()+ " VS." + game[j].getName());
}
}
}
}
class Teams
{
String teamName;
int wins;
public Teams()
{
}
public Teams (String teamName, int wins)
{
this.teamName = teamName;
this.wins = wins;
}
public String getName()
{
return teamName;
}
public int getWins()
{
return wins;
}
}
THIS IS THE OUTPUT I GET:
NCSU VS.UNCC
NCSU VS.GT
NCSU VS.GSU
NCSU VS.UGA
USC VS.UNCC
USC VS.GT
USC VS.GSU
USC VS.UGA
UVA VS.UNCC
UVA VS.GT
UVA VS.GSU
UVA VS.UGA
UNC VS.UNCC
UNC VS.GT
UNC VS.GSU
UNC VS.UGA
Any ideas? Thanks!
Justin9825 20 Light Poster
Oh I didn't see you mention that. Thanks so much for help. This was so stressful.
Justin9825 20 Light Poster
I did something like that, I think.
cout << "Enter the employee postion: ";
cin >> employeePos;
while (employeePos != 'm' && employeePos != 's' && employeePos != 'e')
{
cout << "Invalid Code!\n\n" ;
cout << "Enter the employee postion: ";
cin >> employeePos;
}
It works and repeats the question until it get m, e, or s. Any suggestions on the "0" to quit question? Btw.. Thanks so much for your help this is the last question then the program is complete!
Justin9825 20 Light Poster
Ok never mind I got the first part of my problem. Just can you explain to me how I do this.... Please enter an employee number (between 0 and 2000) or enter 0 to quit? Making it so the user can quit the program?
Justin9825 20 Light Poster
See the previous code never asked for the employee number. But I fixed that problem. Now I'm just trying to figure out how to do what I did with employee number and hours to employee position and insurance code. I need to make so if you enter a invalid character. It re-asks the question. Also I was wondering how in the first question (Employee Number) how do I make it so the user can enter "0" to quit the program?
//Justin Toler
//Final Project CIS 115 900
//4-30-2010
//Extra Credit: Added 401K function to caculate amount to take out for 401K plan
#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
//declare function variables
double calcTax(double);
double grossPay();
double payRate();
double calcNetPay(double, double);
double calcTotalDed(double, double, double, double, double);
double getPayRate(char);
double calcIns(double, double, double);
double getInsRate(double, int);
double calcRetire(double);
double calcBonus(double);
double calcTotalPay(double, double);
double calcGrossPay(double, double);
void displayOutputData(double, double, double, double, double, double, double, double, double, int const);
void displayInputData(double, double, char, int);
int main()
{
//declare variables
double hours = 0.0, rate = 0.0, pay = 0.0, payRate = 0.0,
gross = 0.0, bonus = 0.0, tax = 0.0, insurance = 0.0,
insRate = 0.0, position = 0.0,ssAmt = 0.0,ded = 0.0,
totalPay = 0.0, netPay = 0.0, retire = 0.0, code = 0.0;
int employeeHrs = 0, insuranceType = 0;
char employeePos = 0 ;
int const medicalAmt = 100;
cout << "Please enter an employee number (between 0 and 2000): ";
cin >> code;
while (code < …
Justin9825 20 Light Poster
Ok,, I've done a lot of work to this program. My only problem now, which seems to be a simple one, is that I can't get the employee position to work. When I make it int it just doesn't work at all, it just asks for position instead of number. When I make it a char, it works. But it jumbles up all the text when it asks for position.
//Justin Toler
//Final Project CIS 115 900
//4-30-2010
//Extra Credit: Added 401K function to caculate amount to take out for 401K plan
#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
//declare function variables
double calcTax(double);
double grossPay();
double payRate();
double calcNetPay(double, double);
double calcTotalDed(double, double, double, double, double);
double getPayRate(char);
double calcIns(double, double, double);
double getInsRate(double, int);
double calcRetire(double);
double calcBonus(double);
double calcTotalPay(double, double);
double calcGrossPay(double, double);
void displayOutputData(double, double, double, double, double, double, double, double, double, int const);
void displayInputData(double, char, int);
int main()
{
//declare variables
double hours = 0.0, rate = 0.0, pay = 0.0, payRate = 0.0, gross = 0.0,
bonus = 0.0, tax = 0.0, insurance = 0.0,
insRate = 0.0, position = 0.0,ssAmt = 0.0,
ded = 0.0, totalPay = 0.0, netPay = 0.0, retire = 0.0;
int employeeHrs = 0, insuranceType = 0;
int employeeNum = 0;
char employeePos = 0 ;
int const medicalAmt = 100;
while(employeeNum != 0)
{
cout << "Enter the employee number. " ;
cin >> employeeNum;
}
while (employeePos != 'm' && employeePos != 's' && employeePos != …
Justin9825 20 Light Poster
There! I finally got everything I have working. Now to clean it up and add the rest of the assignment code to it.... Hopefully I won't need anymore help. Thanks a lot you guys!
Justin9825 20 Light Poster
#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
double calcTax(double grossPay, double taxAmt);
double grossPay();
double payRate();
double getPayRate(char employeePos);
double calcIns(double insRate, double grossPay, double insAmt);
double getInsRate(double grossPay);
double calcBonus(double grossPay);
double calcGrossPay(double, double);
void displayData(double, double, double, double, double, double );
int main()
{
//declare variables
double hours = 0.0, rate = 0.0, pay = 0.0, payRate = 0.0, gross = 0.0,bonus = 0.0, tax = 0.0, insur = 0.0, insRate = 0.0, position = 0.0;
int employeeHrs = 0;
char employeePos = 0;
// end while
while (employeePos != 'm' && employeePos != 's' && employeePos != 'e')
{
cout << "Enter the employee postion.";
cin >> employeePos;
} // end while
while (employeeHrs <= 0)
{
cout << "Enter the hours worked: ";
cin >> employeeHrs;
}
//get and calculate hours and pay
payRate = getPayRate(employeePos);
gross = calcGrossPay(payRate, employeeHrs);
double getInsRate(double gross);
double calcBonus(double gross);
double calcTax(double gross);
displayData(rate, position, gross, bonus, tax, insur);
//display
system("pause");
return 0;
}
double getPayRate(char employeePos)
{
double payRate;
if (employeePos == 'm')
payRate = 700;
else if (employeePos == 's')
payRate = 600;
else
payRate = 500;
return payRate;
}
double calcGrossPay(double payRate, double employeeHrs)
{
double grossPay = 0;
grossPay = payRate * employeeHrs;
return grossPay;
}
double calcTax(double gross)
{
double taxAmt;
if(gross >100)
taxAmt = gross * .15;
else if(gross >500)
taxAmt = gross * .10;
else if(gross >1000)
taxAmt= gross * .05;
else
taxAmt = 0;
return taxAmt;
}
double getInsRate(double gross) // removed …
Justin9825 20 Light Poster
#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
double calcTax(double grossPay, double taxAmt);
double grossPay();
double payRate();
double getPayRate(char employeePos, double payRate);
double calcIns(double insRate, double grossPay, double insAmt);
double getInsRate(double grossPay);
double calcBonus(double grossPay, double bonusPay);
double calcGrossPay(double, double);
void displayData(double, double, double, double, double, double );
int main()
{
//declare variables
double hours = 0.0, rate = 0.0, pay = 0.0, payRate = 0.0, gross = 0.0,bonus = 0.0, tax = 0.0, insur = 0.0, insRate = 0.0, position = 0.0;
int employeeHrs = 0;
char employeePos = 0;
// end while
while (employeePos != 'm' && employeePos != 's' && employeePos != 'e')
{
cout << "Enter the employee postion.";
cin >> employeePos;
} // end while
while (employeeHrs <= 0)
{
cout << "Enter the hours worked: ";
cin >> employeeHrs;
}
//get and calculate hours and pay
rate = getPayRate(employeePos, payRate);
gross = calcGrossPay(payRate, employeeHrs);
double getInsRate(double gross);
double calcBonus(double gross, double bonusPay);
double calcTax(double gross, double taxAmt);
displayData(rate, position, gross, bonus, tax, insur);
//display
system("pause");
return 0;
}
double getPayRate(char employeePos, double payRate)
{
if (employeePos == 'm')
payRate = 700;
else if (employeePos == 's')
payRate = 600;
else
payRate = 500;
return payRate;
}
double calcGrossPay(double payRate, double employeeHrs)
{
double grossPay = 0;
grossPay = payRate * employeeHrs;
return grossPay;
}
double calcTax(double gross, double taxAmt)
{
if(gross >100)
taxAmt = gross * .15;
else if(gross >500)
taxAmt = gross * .10;
else if(gross >1000)
taxAmt= gross * .05;
else
taxAmt = …
Justin9825 20 Light Poster
Employee position is returning 109'm' whenever I type m?
Justin9825 20 Light Poster
I hope you guys don't give up on me and think I'm just dumb. But I don't understand what I've done now. Now it won't calculate anything. It runs the prompts fine. Just the output displays nothing at all. I guess because I can't get the gross to calculate right which is why the rest isn't working because it depends on that gross pay.
#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
double ot = 0;
double calcTax(double grossPay, double taxAmt);
double grossPay();
double payRate();
double getPayRate(char employeePos, double payRate);
double calcIns(double insRate, double grossPay, double insAmt);
double getInsRate(double grossPay);
double calcBonus(double grossPay, double bonusPay);
double calcGrossPay(double, double);
void displayData(double, double, double, double, double, double );
int main()
{
//declare variables
double hours = 0.0, rate = 0.0, pay = 0.0, payRate = 0.0, gross = 0.0, employeeHrs = 0.0, bonus = 0.0, tax = 0.0, insur = 0.0, insRate = 0.0, position = 0.0;
char employeePos = 0.0;
char employeeNum = 0;
while(employeeNum != '0')
{
cout << "Enter the employee number. Enter a 0 (zero) to quit: ";
cin >> employeeNum;
}
// end while
while (employeePos != 'm' && employeePos != 's' && employeePos != 'e')
{
cout << "Enter the employee postion.";
cin >> employeePos;
} // end while
while (employeeHrs <= 0)
{
cout << "Enter the hours worked. It must be greater than 0: ";
cin >> employeeHrs;
if (employeeHrs <= 0)
cout << "Your hours worked must be > 0. Please enter a valid …
Justin9825 20 Light Poster
I figureded it was something simple. Can you help me unserstand what the teacher wants when she says:
This function should contain a loop that processes employee payroll data until a sentinel value is entered by the user. A typical case would be to condition the loop on the employee number, checking for a sentinel value in the employee number field.
The main function should also contain a loop that validates the employee position entered by the user.
For example, a while loop conditioned by multiple comparisons might be used (employee position != ‘m’ && employee position != ‘s’ && employee position != ‘e’).
A validation loop for employee hours entered by the user should also be used to only accept a value greater than zero.)
Employee insurance type entered by the user should be validated using a while loop with multiple conditions (employee insurance type != 1 && employee insurance type != 2 . . . ).
Did I do what she wanted for employee position? What exactly is it doing?
Justin9825 20 Light Poster
I know. Trust me I know this code probably looks like crap. I was trying to get the hard parts out of the way. I just can't figure out why the while loop isn't stopping. See the pay rate is based on the employee position. trying to figure out how to code the employee position in the criteria it states.
Justin9825 20 Light Poster
I just have one last question and then I might be able to figure this program out. I've updated my code trying to add another part of the project in. It runs fine but I can't get it to stop saying "Enter employee position". Once I type M as the employee position it just says "enter employee position over and over again. I understand how the call function works now. I just having a hard time knowing where to put the cin or cout statements, rather I put them in the main function of a function as it's own. I guess my question is how do I stop the while loop? This is my updated code:
#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
double ot = 0;
double getHoursWorked();
double calcTax(double grossPay, double taxAmt);
double grossPay();
double employeePos;
double getPayRate(int employeePos, double payRate);
double calcIns(double insRate, double grossPay, double insAmt);
double getInsRate(double grossPay);
double calcBonus(double grossPay, double bonusPay);
double calcGross(double, double, double);
void displayData(double, double, double, double, double, double, double );
int main()
{
//declare variables
double hours = 0.0, rate = 0.0, pay = 0.0, grossPay = 0.0, bonus = 0.0, tax = 0.0, insur = 0.0, insRate = 0.0, position = 0.0;
int employeePos = 0.0;
// end while
while (employeePos != 'm' && employeePos != 's' && employeePos != 'e')
{
cout << "Enter the employee postion.";
cin >> employeePos;
} // end while
//get and calculate hours and pay
pay = getPayRate(hours, rate);
hours = getHoursWorked(); …
Justin9825 20 Light Poster
Thank you so much! I'll probably be needing some more help with all of this before Friday. (If you don't mind?) I've just been trying to put part by part together because I just started learning about this stuff. Thanks again!
Justin9825 20 Light Poster
I found out when I run the program it is multiplying my insurance rate times the hours worked. I can't find out why because my ins function looks just like my tax function and the tax function displays the right value. I revised my code a little too.....
#include<iostream>
#include<iomanip>
using namespace std;
double ot = 0;
double getHoursWorked();
double getPayRate();
double calcTax(double grossPay, double taxAmt);
double grossPay();
double calcIns(double insRate, double grossPay, double insAmt);
double getInsRate(double insuranceType, double insRate, double grossPay);
double calcBonus(double grossPay, double bonusPay);
double calcGross(double, double, double);
void displayData(double, double, double, double, double, double, double );
int main()
{
//declare variables
double hours = 0.0, rate = 0.0, grossPay = 0.0, bonus = 0.0, tax = 0.0, insur = 0.0, insRate = 0.0;
//get and calculate hours and pay
hours = getHoursWorked();
rate = getPayRate();
insur = getInsRate(grossPay, rate, grossPay);
grossPay = calcGross(hours, rate, tax);
bonus = calcBonus(grossPay, rate);
tax = calcTax(grossPay, tax);
displayData(hours,rate,ot,grossPay, bonus, tax, insur);
//display
system("pause");
return 0;
}
double getHoursWorked()
{
double hrs;
cout << "Please enter the number of hours worked: ";
cin >> hrs;
return hrs;
}
double getPayRate()
{
double pay;
cout << "Please enter your pay rate: $";
cin >> pay;
return pay;
}
double calcGross(double hrs, double pay, double grossPay)
{
grossPay = pay * hrs;
return grossPay;
}
double calcTax(double grossPay, double taxAmt)
{
if(grossPay >100)
taxAmt = grossPay * .15;
else if(grossPay >500)
taxAmt = grossPay * .10;
else if(grossPay >1000)
taxAmt= grossPay * …
Justin9825 20 Light Poster
calcIns is a FUNCTION, not a VALUE in your program. You have no variable called calcIns. I assume you want to display the results of a CALL to the function, not the function itself. In that case, you need to call calcIns and assign a variable to equal the return value, then display that variable.
Thus line 124 should be changed to something like this.
// b, c, and d are variables of type double. Replace them with whatever doubles you need to call that function. double a = calcIns(b, c, d); cout << "Ins Rate" << setw(9) << right << a << endl;
I don't quite get what your saying. Why can't I do this:
cout << "Ins Rate" << setw(9) << right << insAmt << endl;
Because in my calcIns function it returns insAmt. But when I run the program and type "1" as the insurance type it gives me .05 for $164 gross pay. It should be somewhere where around $3.00. $164*.02
Justin9825 20 Light Poster
I'm completely new to C++ and trying to figure this stuff out I had posted a topic a couple days ago. After many frustrations and headaches, I deiced to start over. This is what I got:
#include<iostream>
#include<iomanip>
using namespace std;
double ot = 0;
double getHoursWorked();
double getPayRate();
double calcTax(double grossPay, double taxAmt);
double grossPay();
double calcIns(double insRate, double grossPay, double insAmt);
double getInsRate(double insuranceType, double insRate);
double calcBonus(double grossPay, double bonusPay);
double calcGross(double&, double);
void displayData(double, double, double, double, double, double, double );
int main()
{
//declare variables
double hours = 0.0, rate = 0.0, gross = 0.0, bonus = 0.0, tax = 0.0, insur = 0.0;
//get and calculate hours and pay
hours = getHoursWorked();
rate = getPayRate();
insur = getInsRate(gross, rate);
gross = calcGross(hours, rate);
bonus = calcBonus(gross, rate);
tax = calcTax(gross, tax);
displayData(hours,rate,ot,gross, bonus, tax, insur);
//display
system("pause");
return 0;
}
double getHoursWorked()
{
double hrs;
cout << "Please enter the number of hours worked: ";
cin >> hrs;
return hrs;
}
double getPayRate()
{
double pay;
cout << "Please enter your pay rate: $";
cin >> pay;
return pay;
}
double calcTax(double grossPay, double taxAmt)
{
if(grossPay >100)
taxAmt = grossPay * .15;
else if(grossPay >500)
taxAmt = grossPay * .10;
else if(grossPay >1000)
taxAmt= grossPay * .05;
else
taxAmt = 0;
return taxAmt;
}
double calcBonus(double grossPay, double bonusPay)
{
if(grossPay >100)
bonusPay = 1000;
else if(grossPay > 9000)
bonusPay = 600;
else
bonusPay = 0;
return bonusPay;
}
double getInsRate(double insuranceType, …
Justin9825 20 Light Poster
Ok... So I finally got the program to run. But when I enter the empolyee number and then the employee position (M,S, or E). It just says... "The Employee must have worked a minimum of 1 hour to process payroll" over and over.
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <cassert>
using namespace std;
//Declare Variables
double code;
double positionPay = 0;
double hours = 0;
double ot = 0;
double grossPay = 0;
double statusPay = 0;
double bonus = 0;
double tax = 0;
double medicare = 0;
int insurance = 0;
double socialSecurity = 0;
double pay = 0;
double totalDeductions = 0;
double netPay = 0;
double employeeSalary = 0;
int name;
int main()
{
//Set Decimal Precision
cout << "Please enter an Employee Number (between 100 and 200 inclusively): ";
cin >> code;
while (code < 100 ||code > 201)
{
cout << "Invalid Employee Number!"<<endl;
cout << "Please enter an Employee Number(between 100 and 200 inclusively): ";
cin >> code;
}
// Prompt the user to enter Employee's Position
cout << "Please enter the Employee's Position: M = Manager, S = Supervisor, E = Employee: ";
int position;
cin >> position;
position = toupper(position);
// Compute Position Pay
double positionPay = 0;
if (position == 'M')
{
positionPay = 40.00;
}
else if (position == 'S')
{
positionPay = 20.00;
}
else if (position == 'E')
{
positionPay = 10.00;
}
else
{
cout << "Error: invalid status";
}
{
//Prompt …
Justin9825 20 Light Poster
I think if I can fix that semicolon in line 22 or around there. It will fix the other errors. Only problem is I've been looking for the past 3 hours on what is wrong.
Justin9825 20 Light Poster
Meh.
+1 for managing to use code tags on the first post - that was promising...
-1 for posting code lacking any indentation at all.
-20 for just dumping a sorry mess of code and not saying a damn word about it.What's wrong with it?
What does it do?
What is it supposed to do?I suppose the only bright spot is that it's Friday. The usual form is midnight (or 30 minutes).
That's funny. I realized all of that after I posted it and was typing it up as you were typing yours, i guess. Any suggestions? Thanks!
Justin9825 20 Light Poster
I should of said in the first post.... You can tell it yet another payroll program. Also these are the errors I get ..... (and I just can't find fix error 3 for the life of me!)
Error 2 error C2365: 'Payroll::mainMenuOption' : redefinition; previous definition was 'member function' (LINE 22)
Error 3 error C2059: syntax error : '{' (LINE 23)
Error 4 error C2334: unexpected token(s) preceding '{'; skipping apparent function body (LINE 23)
Error 5 fatal error C1075: end of file found before the left brace '{' at 'c:\users\justin\desktop\83618-4\cpp5\chap13\ch13appe02 solution\ch13appe02 project\ch13appe02.cpp(38)' was matched c:\users\justin\desktop\83618-4\cpp5\chap13\ch13appe02 solution\ch13appe02 project\ch13appe02.cpp (LINE 343)
Justin9825 20 Light Poster
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <cassert>
using namespace std;
class Payroll
{
public:
int menu();
int option;
int mainMenuOption();
int payrollMenu();
int employeeMenu();
int employeeOption;
int payrollOption();
int anotherOption();
int exitOption();
int mainMenuOption;
{
system("cls");
cout << "\t\t Docket Materials Company\n\n";
cout << "\t\t Main M E N U option\n\n";
cout << "\t\t[1.]Calculate Employee Salary\n\n";
cout << "\t\t[2.]Print Employee Payroll Information\n\n";
cout << "\t\t[3.]Calculate Another Employee\n\n";
cout << "\t\t[4.]Exit\n\n";
cout << "Please Enter Menu Option: 1, 2, 3, or 4";
cin >> mainMenuOption;
return mainMenuOption;
}
void employeeSalary()
{
system("cls");
string name,dummy;
//Declare Variables
double code;
double positionPay = 0;
double hours = 0;
double ot = 0;
double grossPay = 0;
double statusPay = 0;
double bonus = 0;
double tax = 0;
double medicare = 0;
double socialsecurity = 0;
double pay = 0;
double totalDeductions = 0;
double netPay = 0;
//Count the Employees
cout.setf(ios::fixed,ios::floatfield);
cout.precision(2);
//Set Decimal Precision
cout << "Please enter an Employee Number (between 100 and 200 inclusively): ";
cin >> code;
while (code < 100 ||code > 201)
{
cout<<"Invalid Employee Number!"<<endl;
system("pause");
system("cls");
cout << "Please enter an Employee Number(between 100 and 200 inclusively): ";
cin >> code;
}
getline(cin, dummy);
cout << "Please enter the Employee's Name: Example: Last Name, First Name: ";
getline(cin, name);
// Prompt the user to enter Employee's Position
cout << "Please enter the Employee's Position:\n"
<< "M = Manager, S = Supervisor, E = Employee: ";
int position;
cin >> position; …