Question: Create a class called Person that has the following six attributes: personId: int firstName: string lastName: string favoriteColour: string age: int isWorking: bool Ensure that


  1. Create a class called Person that has the following six attributes:
  • personId: int
  • firstName: string
  • lastName: string
  • favoriteColour: string
  • age: int
  • isWorking: bool
  1. Ensure that the Person class has the following methods:
  • DisplayPersonInfo: accepts the six person attributes and displays (Name= firstName + lastName) personId: Name's favorite color is favoriteColour
  • ChangeFavoriteColour: changes the person's favorite colour to white
  • GetAgeInTenYears: get the person's age after 10 years
  • ToString method: displays all Person Object information as a list
  1. Create a class called Relation that has one attribute:
  • RelationshipType: values canbe Sister, Brother, Mother or Father
  1. Ensure the Relation class has the following method:
  • ShowRelationShip: accepts two Person objects and displays the relationship between them


  1. Create a Main class.
    1. Create four objects using the following data:
  1. personId
  1. firstName
  1. lastName
  1. favoriteColour
  1. age
  1. isWorking
  1. 1
  1. Ian
  1. Brooks
  1. Red
  1. 30
  1. Yes
  1. 2
  1. Gina
  1. James
  1. Green
  1. 18
  1. No
  1. 3
  1. Mike
  1. Briscoe
  1. Blue
  1. 45
  1. Yes
  1. 4
  1. Mary
  1. Beals
  1. Yellow
  1. 28
  1. Yes
  1. Display Gina's information as a sentence that shows her id, first name, last name and her favorite colour.
  2. Display all of Mike's information as a list.
  3. Change Ian's Favorite Colour to white, and then print his information as a sentence.
  4. Display Mary's age after ten years.
  5. Create two Relation Objects that show that Gina and Mary are sisters, and that Ian and Mike are brothers. Then, display both relationships.
  6. Add all the Person objects to a list, and then use the list to display the following:
  • The average age of the people in the list
  • The youngest person and the oldest person
  • The names of the people whose first names start with M
  • The person information of the person that likes the colour blue

SampleRun

2: Gina James's favorite colour is Green

PersonId: 3

FirstName: Mike

LastName: Briscoe

FavoriteColour: Blue

Age: 45

IsWorking: True

1: Ian Brooks's favorite colour is: White

Mary Beals's Age in 10 years is: 38

Relationship between Gina and Mary is: Sisterhood

Relationship between Ian and Mike is: Brotherhood

Average age is: 30.25

The youngest person is: Gina

The oldest person is: Mike

PersonId: 3

FirstName: Mike

LastName: Briscoe

FavoriteColour: Blue

Age: 45

IsWorking: True

PersonId: 4

FirstName: Mary

LastName: Beals

FavoriteColour: Yellow

Age: 28

IsWorking: True

PersonId: 3

FirstName: Mike

LastName: Briscoe

FavoriteColour: Blue

Age: 45

IsWorking: True

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Algorithms Questions!