Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I\'m also having some trouble getting it to allow me to input the information in

ID: 3640501 • Letter: I

Question

I'm also having some trouble getting it to allow me to input the information in the "private" functions unlike the "public" functions.  I would appreciate help with this homework.

Object Construction and Data Abstraction

Homework

----------------------------------------------------------------------------------------------

Employee Class

 

Scenario and Summary

We begin our investigation of object-oriented programming by creating an object-oriented program with a class called Employee. You will create two objects based on the Employee class, along with a class that contains the main method. The attributes, constructors, and methods for this class must satisfy the requirements in Steps 1 through 3. After you create the objects, you will prompt the user for information and then display it.

We will want to ensure that this first class is well-constructed and tested since we will extend this class in future assignments.

 

Deliverables

STEP 1: Understand the UML Class Diagram

Use the following UML diagram [See provided clip image #1] to build the class.  The first section specifies the attributes.  The second section specifies the behaviors, and the first character specifies the access modifier value, where:

 Clip Image #1

STEP 2: Code The Employee Class

 

STEP 3: Code The Main Program

In the Main class, create code statements that perform the following operations. Be sure you follow proper commenting and programming styles (header, indentation, line spacing, etc.).

 

STEP 4: Compile and Test

When done, compile and run your code.

Then, debug any errors until your code is error-free.

Check your output to ensure that you have the desired output, modify your code as necessary, and rebuild.

 

 STEP 5: Screen Prints [Output]

Capture the Console output window and paste into a Word document. The following is a sample screen. [See provided clip image #2.]

Clip Image #2

_______________________________________________________________________________

Now here is what I have so far.  I tried to space it out some to simulate what it might look like in Visual Studio:

#include <iostream>
#include <iomanip>
#include <string>
#include <stdlib.h>
using namespace std;

 

class Employee 

{

 public:    

Employee();

Employee(string first, string last, char gen, int dep, double salary); 

 string getFirstName();   //Accessors and mutators, one for each class attribute

{

return firstName;

}

void setFirstName(string name);

{

firstName = name;

}

string getLastName();

{

 return lastName;

}

void setLastName(string name);

 {

lastName = name;

}

char getGender()

{

 return gender;

}
void setGender(char gen);

{

 switch (gen)

}

{

case 'f':case 'F': case 'M':case 'm':

gender = gen;

break;

default:

gender = DEFAULT_GENDER;

}

int getDependents();

{

return dependents;

}
void setDependents(int dep);

{

if (dep >= MIN_DEPENDENTS && dep <= MAX_DEPENDENTS)

}

{

dependents = dep;

}

{

else if (dep < MIN_DEPENDENTS)

}

{

dep = MIN_DEPENDENTS;

}

{

else

}

{

dependents = MAX_DEPENDENTS;

}


double getAnnualSalary();

{

return annualSalary;

}


void setAnnualSalary(double salary);

{

if (salary >= MIN_SALARY && salary <= MAX_SALARY)

}

{

annualSalary = salary;

}

{

else if (salary < MIN_SALARY)

}

{

annualSalary = MIN_SALARY;

}

{

else

}

{

annualSalary = MAX_SALARY;

}

{

double calculatePay();

}

{

return annualSalary/NUMBER_WEEKS;

}


void displayEmployee();

void Main();

{

firstName = "not given";

lastName = "not given";

gender = 'U';

dependents = 0;

annualSalary = 20,000;

double calculatePay();

void displayEmployee();

string getFirstname();

void setFirstName(string first);

string getLastName();

void setLastName(string last);

char getGender();

void setGender(char gen);

int getDependents();

void setDependents(int dep);

double getAnnualSalary();

}

{

cout<<"Employee Information "; cout<<"____________________________________________________________ "; cout<<"Name: " <<firstName << " " << lastName << " "; cout<<"Gender: " << gender << " "; cout<<"Dependents: " << dependents << " "; cout<<"Annual Salary: " << setprecision(2)<<showpoint<<fixed<<annualSalary << " "; cout<<"Weekly Salary: " << setprecision(2)<<showpoint<<fixed<<calculatePay();

}

}

Explanation / Answer

The program is totally wrong and erroneous. First write it syntactically correct.

Dont do function declarations in main function.

What are so many brackets doing here?
void setDependents(int dep);
{
if (dep >= MIN_DEPENDENTS && dep <= MAX_DEPENDENTS)
}
{
dependents = dep;
}
{
else if (dep < MIN_DEPENDENTS)
}
{
dep = MIN_DEPENDENTS;
}
{
else
}
{
dependents = MAX_DEPENDENTS;
}


When you define a function you dont add a semicolon in the end
void setAnnualSalary(double salary);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote