Instructions: Create a C# program that uses a class named Triangle (shown below) in order to produce a subclass of Triangle called Prism. Use the program to create a Prism object that calculates the volume and surface area of the Prism when supplied the width, height, and length of the Prism. The volume of the Prism should be calculated by multiplying the area of the triangle by the length of the Prism.

Prompt the user for the values of width, height, and length. Validate these values to make sure they are not negative. If a negative value is entered, force the user to make another entry. If all three values are zero, use a default constructor that you create for Prism that takes the default value of width and height from Triangle and assigns a value of 10 to length in the default constructor of Prism. Within the subclass Prism include an overriding method named findArea() that computes the surface area of the prism (the sum of the areas of all five sides). Obtain the area of the end of the prism from the findArea() method in the Triangle class. Use this value and the area of each side to compute the total surface area of a Prism. (ie., surface area = 2 times the area of an end plus the three sides. You many assume that the ends are isosceles triangles. How do you find the area of an isosceles triangle? Look it up! You will also need to calculate the length of the slanting side so you can use it to find the surface area. (Welcome to Geometry 101!)

Print the values of width, height, length, volume, and surface area before asking the user if he/she would like to create another Prism. Round all output results to 2 decimal places. Display an appropriate message when the user enters 'n' or 'N'.

Lab 20 has started for Your Name

Enter the value for width 5.1
Enter the value for height 9.4
Enter the value for Length 6.7

The width of the Prism is xx.x
The height of the Prism is xx.x
The length of the Prism is xx.x
The Volume is xxx.xx cubic units
The Surface area is xxx.xx square units

Would you like to enter more data (Y/N) Y

Enter the value for width -5.6
The width many not be Negative! Please re-enter!
Enter the value for width 8.1

Enter the value for height -5.6
The height many not be Negative! Please re-enter!
Enter the value for height 6.8

. . .

Lab 20 has successfully terminated for Yourname
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.