Question
Advanced C# (In C# Code) Lab Assignment 1 - Employee Class Problem Statement Create an application with a class named Employee, which contains the following:
Advanced C# (In C# Code)
Lab Assignment 1 - Employee Class
Problem Statement
Create an application with a class named Employee, which contains the following:
Private fields for an employee's name, ID number, department, and position of appropriate data
type
Parameterless (no-arg) Constructor which does not receive any arguments and initializes the
private fields to the appropriate value. Do not use object initializer syntax. Explicitly assign a
value to each private field.
Parameterized Constructor which receives four arguments and assigns the values to the private
fields. Do
not use object initializer syntax. Explicitly assign a value to each private field.
Properties which get and set the values of the corresponding private fields
Main Menu
The user interface will be provided by a text menu that allows the user to perform create, read, update,
and delete (CRUD) operations on a list of employees or quit. Something along the lines of:
1. View Employees (read)
2. Add Employee (create)
3. Edit Employee (update)
4. Delete Employee (delete)
5. Quit
Each of the capabilities expressed by the menu will result in another interface.
View Employees
The view employees should list employees in the list. A refinement would be paging, but that isn't
required now (use the command line window scroll bars as needed). Something along the lines of:
Employees
--------------
Name, ID Number, Department, Position
Susan Smith, 47899, Accounting, Vice President
Venu Gupta, 3200, Human Resources, Plebe
...
Press Enter to Return to Main Menu
BCIS 3343 - Advanced C# Lab Assignment
2
Add Employee
The add employee screen (so to speak) should prompt the user for its fields.
Name:
ID Number:
Department:
Position:
Once a record's fields have been entered the screen should display a summary and ask the user to confirm
adding the record:
Name: Will Senn
ID Number: 10022
Department: CIS
Position: Assistant Professor
Save (Y/N)?
Add another employee (Y/N)?
If the user picks no, don't save the record, and if they answer no to adding another, should return to the
main menu.
Edit Employee
The edit employee screen should ask for an employee id to edit. A refinement would be allowing for
names, partial names, etc, but not needed now. It might look like this:
Employee ID:
The user would provide an id and the screen would display the current record one field at a time and allow
the user to enter a new value or just press enter to accept the existing value:
Name: [Will Senn]:
ID Number: [10022]:
Department: [CIS]: Marketing
Position: [Assistant Professor]: Full Professor
Then display a summary and ask the user to confirm editing the record:
Name: Will Senn
ID Number: 10022
Department: Marketing
Position: Full Professor
Save (Y/N)?
Edit another employee (Y/N)?
If the user picks no, don't save the updated record, and if they answer no to editing another, should return
to the main menu.
BCIS 3343 - Advanced C# Lab Assignment
3
Delete Employee
The delete employee screen should ask for an employee id to edit. It might look like this:
Employee ID: 47899
It would display the current record's fields and ask the user to confirm the deletion of the record. It might
look something like this:
Name, ID Number, Department, Position
Susan Smith, 47899, Accounting, Vice President
Delete the record (Y/N)?
Delete another (Y/N)?
If the user picks no, don't delete the record, and if they answer no to deleting another, should return to the
main menu.
Additional Requirements
An employee object (instance of our Employee class) will be created for each employee that exists
during the program. A list object (instance of the C# provided List class) will be created at program
startup and will be used to hold all of the employee objects.
An Employee object should be instantiated as needed and the values entered by the user should be
assigned to the private fields of the object using either the Parameterized Constructor or the
Properties.
The Add Employee screen should add Employee objects to the list. All information is REQUIRED
and a message should be displayed if any field is left empty.
The ID number should be validated to ensure appropriate data type (i.e., whole number) and that it is
greater than zero. In each case of invalid data, a message should be displayed and the data reentered.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started