C# Programming: Inheritance

23.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: zip solution files instantly, after Payment

Securely Powered by: Secure Checkout

Description

5/5 - (1 vote)

Develop a console application that has the following:
Write an abstract class called Employee that has:
a. An Employee Id field that is automatically incremented each time a
derived Clerk or Manager class is created.
b. A property for employee ID.
c. A property for the employee’s last name.
d. A property for the employee’s first name.
e. An abstract method for hiring an employee (all you need to do is to return
a string when this method is called that states that an employee has been
hired. In this string mention the employee type and the employee’s first
and last name. Since this method is abstract you will implement the
appropriate functionality in the derived inheritance hierarchy class).
f. An abstract method for firing an employee (you need to state the type of
employee fired as well as last name and first name). Since this is an
abstract class you will implement this functionality in the derived class
g. Have a constructor that is used to populate the property information.
h. Have a ToString method to print out object state as well as the total
number of employees created at the time of using the ToString method.
Write a Manager class that has the following:
a. The Manager class is derived from the Employee class.
b. A property for getting and setting the type car a Manager gets from the
company (managers are allowed a car).
c. A method for this class that implements the abstract Hire method defined
in the Employee class. Remember that all you need to do is to return a
string when this method is called that states that a Manager has been
hired along with the Manager’s last and first name.
d. A method for this class that implements the abstract Fire method defined
in the Employee class. Similar to c make sure that your returned string
states the employee type (Manager) and the manager’s last and first
name.
e. Appropriate constructors for this class.
f. An appropriate ToString method to print out object state.
Write a Clerk class that has the following:
a. The Clerk class is derived from the Employee class.
b. A Boolean property for telling whether the position is unionized (not all
clerks are union employees).
c. Implement the methods needed to hire and fire clerical employees.
d. Appropriate constructors for this class.
e. An appropriate ToString method to print out object state.
Write a class below that tests your inheritance hierarchy (your Employee, Clerk
and Manager classes):
a. Instantiate 1 Manager with the name of “Bill Gates” that gets a Ford
Mustang.
b. Instantiate a second Manager with the name of “Carol Smith” gets a
Chrysler PT Cruiser.
c. Instantiate a Clerk with the name of Hilda Smith who is not unionized.
d. Instantiate a Clerk with the name of Harold Jones
e. Fire Bill gates.
f. Hire Hilda.
g. Instantiate a Manager named Leo Banes who does not get a car yet.
h. Print the data associated with each employee using polymorphism (i.e. put
your employees into a collection and use the ToString method to print out
the appropriate object information. Use a collection to store your different
employee objects and then in a loop print out the appropriate object
information using polymorphism. Remember also to print out the current
total of employee objects.

  • Inheritence.zip