Question: Shape -sides : int -angles: int +Shape() + Shape (s: int, a : int) + setSides(s : int): void + setAngles(a : int): void +

Shape -sides : int -angles: int +Shape() + Shape (s: int, a : int) + setSides(s : int): void + setAngles(a : int): void + getSides():int + getAngles():int 1- Write a class declaration for Shape class and add the two variables to the class declaration sides: is an int variable that holds the number of sides the shape has. angles: is an int variable that holds the number of angles the shape has. 2- The class should have the following constructors: A constructor that accepts the following value as argument and assigns it to the appropriate fields: sides and angles. Ano-arg constructor that assigns 0 to the sides, and 0 to the angles field. 3- Write mutator methods that store values in these fields and accessor methods that return the values in these fields as in above UML diagram. 4- Once you have written the class, write a separate program that creates two Shape objects to hold the following data: sides angles 4 4 5 5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
