Question
Please write a C# code . I posted this question before but someone answered it in java I want C#. This lab has four parts:
Please write a C# code. I posted this question before but someone answered it in java I want C#.
This lab has four parts: 1. Write a Person class. 2. Write a Student and Employee subclass to Person. 3. Write a Faculty and Staff subclass to Employee. 4. Write a program that creates an object of all of the above classes. Task 1 The Person Class First, let us make a simple class titled Person. A person should include: 1. The class variables/attributes/properties: a. Name, b. Address, c. Phone number, d. And email address. 2. An overloaded constructor that allows us to pass in all of the above variables. 3. A ToString method that returns all of the class variables AND the name of the class (which should be Person). Task 2 The Student and Employee Subclasses Now let us begin to use inheritance. Both the Student and Employee classes will inherit from the Person class. A Student should include: 1. One additional class variable, class status (freshman, sophomore, junior, or senior). Define the status as a constant. a. NOTE: The Student class will inherit and keep all the class variables from Person, so we are adding (without any additional code) one class variable to store their class status. 2. An overwritten constructor that takes in one additional parameter which will be used to set the class status. 3. An overwritten ToString method that will print out the class status along with the other variables AND class name (this time it should be Student). An Employee should include: 1. Additional class variables/attributes/properties: a. An office (building name/letter and number, e.g. Atrium 352 or J 352), b. Salary, c. The year, d. The month, e. And the day the Employee was hired. 2. An overwritten constructor that takes five (5) additional variables to set the Employees variables. 3. An overwritten ToString method that will print out the five (5) additional variables along with the previous variables AND class name (this time it should be Employee). Task 3 The Faculty and Staff Subclasses We will create two more classes this time they will both inherit from Employee. A Faculty member should include: 1. Additional attributes: a. Office hours in a week (e.g. 5), b. And a rank (e.g. Senior, Limited Term, etc.). 2. An overwritten constructor that takes two (2) additional variables to set the Facultys variables. 3. An overwritten ToString method that will print out the two (2) additional variables along with the previous variables AND class name (this time it should be Faculty). A Staff member should include: 1. One additional property that represents their title. 2. An overwritten constructor that takes in one additional parameter which will be used to set the title. 3. An overwritten ToString method that will print out the class status along with the other variables AND class name (this time it should be Staff). Task 4 The Driver (Main Program) Let us now use our classes by creating objects. Create one (1) of each of the above classes (1 Person, 1 Student, 1 Employee, 1 Faculty, and 1 Staff object) using user input. Finally, print out the data stored in each object using their ToString methods (DO NOT explicitly call the ToString method when doing so).
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