App Design:

1. Make a windows application in Visual Studio and name it as A2FirstnameLastname.

2. Design and implement a Windows Form application that keeps track of the employees in a company and their earnings information. The application calculates an employee's wages and allow users to review employee information of any previously added employee.

NOTE: At no point should the application save any information to disk. All information is stored and managed in memory using a collection. The use of collections and the object-oriented design of the solution are an important part of the evaluation of your submission.

3. Design a form that looks something like the one below. Feel free to change the layout and colors: see image.

4. Ensure all names follow the naming conventions used in class.

5. Ensure the form is displayed centered on the screen.

6. Ensure the tab order of all controls is set correctly.

Instructions:

1. User selects a type of employee from the radio buttons.

  • You can set one of the radio buttons as default selected.

2. On selecting "Commission Based" radio button, the labels Hours Worked and Hourly Wage should change to Gross Sales and Commission Rate, respectively. (See screenshots at the end of this document).

3. On selecting "Weekly Salary" radio button, the label Hours Worked should change to Weekly Salary, and Hourly Wage label and text box should hide.

4. Then, the user can enter the name of an employee, and the earning details.

5. Upon clicking the "Calculate" button, the application shall calculate and display the gross earnings, taxes and net earnings.

  • Assume a federal tax of 20%.
  • An hourly based employee is paid overtime wages which are calculated as 1.5 times the hourly wage for any hours over 40 hours a week.
  • A commission based employee is paid the commission based on the gross sales and commission rate.
  • A weekly salaried employee just earns the weekly salary.

6. After doing the above calculations, add the employee names to the combo-box. The combo-box shall ONLY display the employee name and no other information.

  • The employee names should be unique.
  • Style the combo-box as DropDownList.

7. The application shall keep track of the employees using the most appropriate generic collection.

8. Upon selecting an existing employee, display the wage information associated with it including earnings.

  • The radio button should be updated according to the type of employee.
  • The name and the following two text boxes should display the appropriate data.
  • The gross earning, tax and net earning should be displayed in the readonly text boxes.

9. The "Clear" button should clear all the fields of the form with the exception of the Employee combo- box.

10. The "Close" button should close the form.

Classes:

1. Create an enum to handle the "type of employee".

2. Create an abstract class Employee.

a. This class stores employee name and employee type.
b. An abstract readonly property GrossEarnings. This property is implemented in each derived class to calculate the earnings of each type of employee.
(readonly means property having only get accessor. This does not mean using the readonly keyword)
c. A readonly property Tax, that calculates and returns the 20% tax.
d. A readonly property NetEarnings that returns the net earnings after tax deductions.
e. In addition to these, you can also create virtual properties HoursWorked, HourlyWage, GrossSales, CommissionRate and WeeklySalary, and override them in the respective derived classes.

3. Inherit the class HourlyEmployee from Employee.

a. This class stores hours worked and hourly wage.
b. Implements the GrossEarnings property that returns the earnings of this employee, considering any overtime at the rate of 1.5.

4. Inherit the class CommissionEmployee from Employee.

a. This class stores the gross sales and commission rate.
b. Implements the GrossEarnings property that returns the earnings of this employee.

5. Inherit the class SalariedEmployee from Employee.

c. This class stores the weekly salary.
d. Implements the GrossEarnings property that returns the earnings of this employee.

6. On the "Calculate" button's click event, after figuring out which type of employee it is, call the GrossEarnings property polymorphically.

Exception Handling:

1. There should be no unhandled exceptions of any kind at run-time.

2. Display all errors resulting from the input validation using MessageBoxes. Validate the input as follows:

a. All fields are required (radio buttons, name, hours worked and hourly wage).
b. The name of the employee should be unique.
c. The hours worked has to be a positive real number and cannot exceed 80.
d. The hourly wage, gross sales, commission rate and weekly salary fields have to be a positive real number.

3. The error messages should be clear and understandable.

a. Something like, "Name field can not be left blank".
b. Not like Invalid input, or Input was not in a correct format.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.