Question: #676

Create an Interface called ICommon

1. Create an Interface called ICommon (in a file called Interfaces.cs). ICommon only contains one member.

Ignore the plus sign on the interface in the UML. We all know that Interfaces cannot have access modifiers specified for them.

2. Create a class called Person (in a file called Person.cs) that “must be inherited”. Make the class Public.

Add the attributes and their respective gets/sets defined in the UML. You DO NOT need to add a get/set for the attribute called numberOfPeople. Don’t forget what an underlined attribute or method means! In this case, create a method called GetNumberOfPeople to return the number of people created.

Next, create a “must override” method called GetFullName. Notice it is italicized, that means it has no method body defined in this class.

Lastly, add a 0-Argument constructor to this class. If needed, initialize all attributes to default values, for example, strings to empty quotes, numbers to zeros, and also increment (by one) the numberOfPeople attribute.

3. Create a class called Professor (in a file called Professor.cs) that is derived from Person. Make the class public.

Add the attribute defined in the UML. You DO NOT need to add a get/set for the attribute called numberOfProfessors. Don’t forget what an underlined attribute or method means! In this case, create a method called GetNumberOfProfessors to return the number of Professors created.

Add a method called GetFullName that returns the Professor’s title and name. For example, using my first and last name, it should return, Professor Chris Martin (if that is what the first and last name attributes were set to).

Lastly, add a 0-Argument constructor to this class. If needed, initialize all attributes to default values, for example, strings to empty quotes, numbers to zeros, and also increment (by one) the numberOfProfessors attribute.

4. Create a class called Student (in a file called Student.cs) that is derived from Person. Make the class Public.

Add the attributes and their respective gets/sets defined in the UML. You DO NOT need to add a get/set for the attribute called numberOfStudents. Don’t forget what an underlined attribute or method means! In this case, create a method called GetNumberOfStudents to return the number of Students created.

Add a method called GetFullName that returns the student’s name with appropriate salutation based on the gender attributes (basically Ms. for a female, and Mr. for a male). To make sure that you’re coding to what I am expecting, assume that I am using “F” for female, and “M” for male to represent the Gender of the Student.

For example, a female student should return, Ms. Sally Smith (if that is what the first and last name attributes were set to) and a male student should return Mr. Bob Builder (if that is what the first and last name attributes were set to).

Add a method called CalculateAverage that takes 2 Scores. Refer to UML for naming and data types. Assign the Average to the Average attribute.

Add another method called CalculateAverage that takes 3 Scores. Refer to UML for naming and data types. Assign the Average to the Average attribute.

Lastly, add a 0-Argument constructor to this class. If needed, initialize all attributes to default values, for example, strings to empty quotes, numbers to zeros, and also increment (by one) the numberOfStudents attribute.

Solution: #693

Interface called ICommon Scored

A+ grade guaranteed! I always give g...
Tutormaster
Rating: A+ Purchased: 11 x Posted By: Vikas
Comments

Online Users