Question: Class Exercise: Shape class Shape.java Shape Driver - ShapeTest.java Write a class called Shape that contains instance data that represents the name and number of

 Class Exercise: Shape class Shape.java Shape Driver - ShapeTest.java Write a

Class Exercise: Shape class Shape.java Shape Driver - ShapeTest.java Write a class called Shape that contains instance data that represents the name and number of sides of the shape, Define a constructor to initialize these values. Include mutator(setter) methods - with the this reference - for the instance data, and a toString method that returns a the shape data. Create a static variable to keep track of the number of shapes and a static method to return the number of shapes entered. Create a driver class called ShapeTest, whose main method instantiates the objects and updates several Shape objects by prompting the user for the information. In the Shape Class, you will need: Two private members to store data A static variable to store the number of shapes. Enter info on 3 shapes: One constructor, which should not accept any values during instantiation Enter the name of the shape:Square Mutators for each private member of the class Enter the number of sides: 4 Astatic method which returns the number of shapes Enter the name of the shape: Hexagon A tostring method to output the information Enter the number of sides: 6 Enter the name of the shape Octagon In the ShapeTest driver. you will need: Enter the number of sides: At three Shape objects (no hardcoded info this time) Here is the info you entered for the 3 shapes: A Scaner Object to get information for all of the objects Shape: Square Local variables to store information No. of sides:4 To reference the static variable (with the updated number of shapes) in the driver Shape: Hexagon No. of sides:6 Here is some sample output: Shape: Octagon No. of sides:8

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!