Question: C# .net question Write a Console App (.NET Framework) that: Makes use of an abstract class called Shape which represents one single shape Creates an
C# .net question
Write a Console App (.NET Framework) that:
Makes use of an abstract class called Shape which represents one single shape
Creates an object hierarchy to include additional classes for:
Rectangle
Square
Box
Cube
Ellipse
Circle
Cylinder
Sphere
Triangle
Tetrahedron
Prompts the user via a menu to create an instance of one of your shapes
Uses polymorphism to store shapes into a list
Continues to prompt until the user selects the exit option
Displays a neat, orderly table of all instantiated shapes, their dimensions, areas and, in the case of three-dimensional shapes, their volumes
The main class (Lab2) should have the following features:
A list to store shapes of any kind
Error checking for user input
The Main( ) method should be highly modularized
You are to use this unmodified code for the abstract Shape class (save and rename as Shape.cs)
Each of your derived classes must implement in some way:
A SetData( ) method that prompts the user to enter each dimension for the current shape
A CalculateArea( ) method that calculates the area of the shape, or for a three-dimensional shape, the surface area
A CalculateVolume( ) method that calculates the volume of three-dimensional shapes only
An overidden ToString( ) method that you can use to print each line of the table
It is recommended that you code each of your classes in a different .cs class file (ie, Square.cs, Circle.cs, etc.)
You may find Wikipedia useful for determing the formulae needed for area and volume calculations
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
