Question: Lab: Creating Classes Background A class is a blueprint or template for creating objects. The programs in C# are composed of classes and objects. Each
Lab: Creating Classes
Background
A class is a blueprint or template for creating objects. The programs in C# are composed of classes and objects. Each class includes a set of attributes and methods that can be used by the objects created using that class.
Instructions
Use C# IDE to write a program as follows.
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 the Person class has the following methods:
DisplayPersonInfo: accepts the six person attributes and displays Name firstName lastName
personId: Names favorite color is favoriteColour
ChangeFavoriteColour: changes the persons favorite colour to white
GetAgeInTenYears: get the persons age after years
ToString method: displays all Person Object information as a list
Create a class called Relation that has one attribute:
RelationshipType: values can be Sister, Brother, Mother or Father
Ensure the Relation class has the following method:
ShowRelationShip: accepts two Person objects and displays the relationship between them
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
