Design a class named geometry using several methods


PROBLEM:

Question- Design a class named Geometry with the following methods:

  • A static method that accepts the radius of a circle and returns the area of the circle.
  • A static method that accepts the length and width of a rectangle and returns the area of the rectangle.
  • A static method that accepts the length of a triangle's base and the triangle's height and returns the area of the triangle.
  • A static method that accepts the length of a trapezoid's two bases and its height and returns the area of the trapezoid.
  • Each method should display an error message if any of the parameter values are non-positive and then return zero as the return value.

Next write a driver class to test the Geometry class. This Driver class should display a menu, read the user input and print the area along with a message stating what the output represents. The user can repeat entering data until he/she wants to quit.

The driver should print an error message when the user enters an invalid menu choice.

Show the code, demonstrate it works properly and describe what it is doing.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Design a class named geometry using several methods
Reference No:- TGS0893417

Expected delivery within 24 Hours