Question: ***Do not declare the fields hight and width with the private keyword. Program 1(40 points: Following the instructions in the problem statement, design and implement

***Do not declare the fields hight and width with the private keyword.
Program 1(40 points: Following the instructions in the problem statement, design and implement a Java program for programming exercise 9.1, page 360 (name it Rectangle.java). Next, develop a test program in a separate file (call it TestRectangle.java)to create two Rectangle objects as stated in the problem statement. In addition to creating the two Rectangle objects required by the textbook problem statement, create a Rectangle object (at least one of the three Rectangle objects must be created using the no-arg constructor and at least one must be created using the constructor that has parameters specifying the objects ength and width). Do not declare the fields width and height with the private keyword, change and display their values without using mutator or accessor methods. Display the width, height, area, and perimeter of each rectangle object using proper labels for the outputs. Document your code and organize the output using appropriate formatting techniques 9. (The Rectangleclass) Following the example of the Circle class in Section 9.2, design a class named Rectangle to represent a rectangle. The class contains Two double data fields named width and height that specify the width and height of the rectangle. The default values are 1 for both width and height A no-arg constructor that creates a default rectangle A constructor that creates a rectangle with the specified width and height A method named getAreaO that returns the area of this rectangle A method named getPerimeter O that returns the perimeter Draw the UML diagram for the class and then implement the class. Write a test program that creates two Rectangle objects-one with width 4 and height 40 and the other with width 3.5 and height 35.9. Display the width, height, area, and perimeter of each rectangle in this order
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
