Question: The Main Objective is to use inheritance and method overriding. Write a C# program that implements the following: Create a class named Figure. a. This

The Main Objective is to use inheritance and method overriding.

The Main Objective is to use inheritance and method overriding. Write a

Write a C# program that implements the following: Create a class named Figure. a. This class is characterized by the following attributes: - A private integer attribute called length. - A private integer attribute called width. - A private integer attribute called area. b. The class Figure includes also a constructor with two arguments: The first argument is used to set the value of length The second argument is used to set the value of width The value of area is set-in by the following formula: (area = length * width.) c. Overload the operator + to add two Figures as follows: - Newlength= 2*length of Figure 1 if length of Figure 1 is equal of length of Figure2 else Newlength=0 - New Width = 2*width of Figure1 if Width of Figure1 is equal of Width of Figure 2 else Newlength=0 d. The class Figure includes also a method PrintInformation to Display all information about a Figure. The main method of your program, implements the following: - Creates an object Figure1. The values of its different attributes are as follows: length = 10, width=20 - Creates an object Figure2. The values of its different attributes are as follow s: length = 20, width = 30 - Creates an object Figure3=Figure1 + Figure2. - Displays information of Figure1; - Displays information of Figure2; - Displays information of Figure3: The program result looks like the following

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 Databases Questions!