Question: in java 1. Use the following comments as a guide to calculate the area of shapes given in the formulas below: public class ShapeArea 1
in java1. Use the following comments as a guide to calculate the area of shapes given in the formulas below: public class ShapeArea 1 // Write a default constructor that initiate the sides of the shape with value 3, and another and overloaded constructor to assign the value of shapes sides given from the user. // Write set and get methods for all instance variables. // TriangleArea will calculate the area of triangle as formula triangle Where b = basa, n= height // ParallelogramArea will calculate the area of parallelogram as formula parafieogram bhWhere base, he height // display method will print the area of the chosen shape using get methods. 1 2. Write the Area App codes that will set 2 objects of shapeArea. Use set methods to assign the values received from the user, calculate the area of chosen shape, and display the area as the sample output given below. Sample output: Welcome to Area of Shapes App Choose which shape you would like to calculate its area (Enter 1 for Triangle, or 2 for Parallelogram): 2 Please Enter Base: 5 Please Enter Height: 7 Area of Parallelogram - 35 Would you like to calculate the area of another shape (1:Yes, 0:No)? 1 Choose which shape you would like to calculate its area (Enter 1 for Triangle, or 2 for Parallelogram): 1 Please Enter Base: 5 Please Enter Height: 7 Area of triangle = 17.5 Would you like to calculate the area of another shape (1:Yes, 0:No)? 0 Thank you
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
