Question: In C# , no top level statements. Tip: Create a Class Library and add it to your project. Assignment 2 : Shape Area Calculator Objective:
In C# no top level statements.
Tip: Create a Class Library and add it to your project.
Assignment : Shape Area Calculator
Objective: Design a set of classes to compute the area of various shapes eg Circle, Rectangle, Triangle Start with an abstract class Shape with the abstract methods CalculateArea and CalculatePerimeter
Shape Area Perimeter Terms
Circle A pi times r Circumference pi r r radius of the circle
Triangle A times b times h S abc b base
h height
ab and c are the sides of the triangle
Square A a P a a length of side
Rectangle A l times w P l w l length
w width
Parallelogram A b times h P ab a side
bbase
hvertical height
Requirements:
Abstract base class called Shape with common Properties get; set; USE BACKING FIELD VARIABLES of Height and Width, you can assume that the a Circles radius is half of either the Height or Width.
Three derived classes Circle, Square, Triangle
Store the objects in a Collection object List Array, HashSet, etc... objects in the collection will be of type Shape
Loop through the list calling CalculateArea and CalculatePerimeter
The output should display the Object Type Circle Square or Triangle the values used to initialize the shape, the area, and the perimeter
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
