Question: Assignment 3 Direction: Submit the typed source code. Parallelogram For this assignment, you will create a Parallelogram class. A parallelogram is a four-sided shapes whose
Assignment 3 Direction: Submit the typed source code. Parallelogram For this assignment, you will create a Parallelogram class. A parallelogram is a four-sided shapes whose opposite sides are parallel and opposites angles are equal (hence opposite sides are equal). The four (4) types of parallelograms and their properties are listed below Regular Rhombus Square Rectangle o Adjacent sides are not equal | o Adjacent sides are equal o No right angles Adjacent sides are equal o All right angles o Adjacent sides are not equal o All right angles No right angles The Parallelogram class should have: Public double field named length. O Public double field named width. Public double field named angle. Public string field named type. Public default constructor that assigns l to both length and width, 90 to angle, and square" to type. Public overloaded constructor that takes two (2) double parameters The parameters should be assigned to length and width. Furthermore, angle should bc assigned 90. Depending on the values of length and width, type should be assigned either "square" or "rectangle" Public overloaded constructor that takes three (3) double parameters. The parameters should be assigned to length, width and angle. Depending on the values of length, width and angle, type should be assigned either "square" or "rectangle' or "rhombus" or "regular" Public double method named Perimeter() that takes no parameters. It should return the perimeter of the parallelogram. Public string method named ToString() that takes no parameters. It should return a string of the following format: type(length, width, angle) In the main function, you should create a Parallelogram object for each type of parallelogram. Then display the information of each object by calling the ToString) and Perimeter methods. When you are displaying the information, display them on the same line with a label before the perimeter to identify it, and format the display so that it will be uniformly spaced. The following is an cxample of a possible output square (1.0,1.0,90.0) rectangle(5.0,8.0,90.0) regular (6.0,12.0,45.0) rhombus (10.0,10.0,60.0) perimeter: 4.0 perimeter: 26.0 perimeter: 36.0 perimeter: 40.0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
