Question: Assignment Description: 1. Create a class to represent a square type in java, the class should have the following fields: A protected variable named sideLength:

 Assignment Description: 1. Create a class to represent a square type

Assignment Description: 1. Create a class to represent a square type in java, the class should have the following fields: A protected variable named "sideLength": a variable to hold the length of a square side. A static variable named "shape": a variable to hold the type of a shape which is "square". 2. The class should have an instance method that prints out the value of the length of a square side along with its perimeter." perimeter of a square = "4 x sideLenght". 3. The class should have a class method that prints out the type of the shape. 4. In the main class, declare and instantiate 2 objects of the square class. 5. Set the variable's values for both objects, and call the instance method that prints out the values and the perimeter of the square. 6. Call the class method that prints out the type of the shape. 7. In the square class, declare a static final variable named "course": a variable to hold the name of the course which is "Math". 8. In the main class, try to change the value of the variable "course

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!