Question: Learning Objectives: Write classes that relate to simple geometric shapes. Create objects from classes that you wrote. 1. Write a class called Square by following

Learning Objectives: Write classes that relate to simple geometric shapes. Create objects from classes that you wrote. 1. Write a class called Square by following steps. a. Write the class header. b. Declare a private instance variable called length. c. Write a constructor that initializes the instance variable in the class. d. Write an accessor method for the instance variable. e. Write a mutator method for the instance variable.

2. Write a class called Test with a main method that: a. creates a Square object and initializes its length to 1.2. b. uses the mutator method to change the length stored in the Square object to 8.8. c. then uses the accessor method to display the length stored in the Square object.

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!