Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions Steps Copy code from Lab 6 OOP into main.cs and employee.cs Update the Employee in Employee.cs PROPERTIES Create properties as shown below: ( Hint:

Instructions
Steps
Copy code from Lab 6 OOP into main.cs and employee.cs
Update the Employee in Employee.cs
PROPERTIES
Create properties as shown below: (Hint: in Cat.cs,Name is property. name is member variable)
FirstName Validation: None (Auto implemented property)
LastName Validation: None (Auto implemented property)
Age Validation: Cannot be less than 18. If so, set as 18.
YearlySalary Validation: Cannot be less than $1000. If so, set it to $1000
Id Validation: None (Auto implemented property)
EmploymentStatus Validation: None (Auto implemented property)
Everywhere inside your Employee.cs instead of using member variables use the properties Example: replace firstname with FirstName
METHODS
Create the following methods
IncreaseSalary()
This method will accept the "percent" as input parameter and calculate the total salary after increase. If the input parameter is valid, a success message is written to console. Else a failure message is displayed.
For example, if the salary is 80000, and the IncreaseSalary method is called with 10% increase as the input parameter, then the total salary will be 80000+8000=88000. This method will set "YearlySalary" property to 88000.
Example: if input is 10% and yearly salary is 88000, then the method will display:
Yearly salary updated to 88000.
if IncreaseSalary method is called with a negative "percent" parameter, the method will not update YearlySalary and display "Invalid input. Yearly Salary not updated".
Invalid input. Yearly Salary not updated.
RemoveEmployee()
This method will not have any input parameter. This method will: first check if employmentstatus is "inactive" if so, write to console "Employee already inactive" if employmentstatus is "active" then change it to "inactive". Write to console Employee removed
TESTING YOUR CLASS
You should test all these conditions and include screenshots. Test with at least 3 sets of employees.
Create employee 1 by calling the Constructor with no parameters.
Call Intro() method for employee 1.
Output should look like this.
Hello! My name is Unknown unknown
Here are some details about me:
Age:18
Id:0
Employment Status:active
Create employee 2 by calling the Constructor with parameters.
FirstName=John
LastName=Smith
Id=1234
Age=45
YearlySalary=50000
Call IncreaseSalary method with -2% as input
Output should look like this:
Invalid input. Yearly Salary not updated.
Call RemoveEmployee. Output should look like this:
Employee removed
Call Intro method.
Hello! My name is John Smith
Here are some details about me:
Age:45
Id:1234
Employment Status:inactive
Create employee 3 by calling the Constructor with parameters.
FirstName=Robert
LastName=Downey
Id=5678
Age=62
For this employee:
Call Intro() method
Set Yearly Salary of this employee to 100.
Call Intro() method for the employee
Output should look like this:
Hello! My name is Robert Downey
Here are some details about me:
Age:62
Id:5678
Employment Status:active
Create employee 4 by calling the Constructor with parameters.
For employee 4: Call IncreaseSalary method with 7% as input
Call RemoveEmployee.
Call RemoveEmployee. (Calling for the 2nd time on purpose)
Call Intro() method
Output should look like this:
Yearly Salary after 7% increase = $ 85600
Employee removed successfully!
Employee already inactive!
Hello! My name is Maria Lambert
Here are some details about me:
Age:26
Id:5010
Employment Status:inactive
Run the test now. Im really confused what goes in the main.cs and tthe employee.cs, I already had the "paste Lab 6 OOP" portion of the question.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions