Question: Please help me ASAP Write a class file to create objects of type Shapes. The class fields must contain 3 variables for sides and one
Write a class file to create objects of type Shapes. The class fields must contain 3 variables for sides and one variable for angle. You can construct different two dimensional shapes such as triangles rectangle, parallelogram,square and rhombus. You can use the default constructor for specifying a shape 1. Then create methods to set values to the 3 sides and set two sides and an angle between them. For example setSideslside 1,side 2,side 3) and setSidesAngles(side 1side 2, Angle12) 2. Create a method for passing the length and breadth information 3. Write a method to calculate the perimeter of the shape Perimeter is calculated by adding the lengths of all sides together. 4. create a method to calculate the areas of each of the shapes Triangle area is 1/2 x base x height If the height is unknown, but all 3 sides are known, use the area of the scalene triangle formula. (Research and get the formula that involves calculating the If two sides and one angle are known use the law of cosines to determine the remaining unknown sides Area of the square/rectangle/parallelogram/rhombus length x 5. Create a method to plot the shape objects on a drawing panel. Note: A square can be constructed by just passing equal vallues for length and breadth. Likewise, a rhombus can be constructed by passing equal values for length and breadth to a parallelogram The only difference between a rectangle/square and parallelogram/rhombus is that the rectangle/square will have all angles as right angles. But this will not allter the way in which you calculate the area and the perimeter Client Code: Your client code must create objects of different shapes by passing the respective arguments and must display the results of perimeter and area for each of the objects. You must read from a text file that contains the number of shapes in the first line followed by the lengths/angles information in the subsequent lines. You must read these data from the text file and store them as an array of Shapes (Array of Objects). You client code must also display the shape on a drawing panel Write a class file to create objects of type Shapes. The class fields must contain 3 variables for sides and one variable for angle. You can construct different two dimensional shapes such as triangles rectangle, parallelogram,square and rhombus. You can use the default constructor for specifying a shape 1. Then create methods to set values to the 3 sides and set two sides and an angle between them. For example setSideslside 1,side 2,side 3) and setSidesAngles(side 1side 2, Angle12) 2. Create a method for passing the length and breadth information 3. Write a method to calculate the perimeter of the shape Perimeter is calculated by adding the lengths of all sides together. 4. create a method to calculate the areas of each of the shapes Triangle area is 1/2 x base x height If the height is unknown, but all 3 sides are known, use the area of the scalene triangle formula. (Research and get the formula that involves calculating the If two sides and one angle are known use the law of cosines to determine the remaining unknown sides Area of the square/rectangle/parallelogram/rhombus length x 5. Create a method to plot the shape objects on a drawing panel. Note: A square can be constructed by just passing equal vallues for length and breadth. Likewise, a rhombus can be constructed by passing equal values for length and breadth to a parallelogram The only difference between a rectangle/square and parallelogram/rhombus is that the rectangle/square will have all angles as right angles. But this will not allter the way in which you calculate the area and the perimeter Client Code: Your client code must create objects of different shapes by passing the respective arguments and must display the results of perimeter and area for each of the objects. You must read from a text file that contains the number of shapes in the first line followed by the lengths/angles information in the subsequent lines. You must read these data from the text file and store them as an array of Shapes (Array of Objects). You client code must also display the shape on a drawing panel
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
