Home / Expert Answers / Computer Science / java-nbsp-this-lab-will-let-you-practice-on-writing-class-and-creating-objects-consisting-of-other-pa866

(Solved): java  This lab will let you practice on writing class and creating objects consisting of other ...



java 

This lab will let you practice on writing class and creating objects consisting of other objects.

Write a program that creat
Main class
Random rectangles
Heres the code I used to generate the value of \( X \) and \( Y \) for the points. lowX is the
Heres the code I used to generate the value of \( X \) and \( Y \) for the Dinint Low \( X \) is the \( X \) value of the le
This lab will let you practice on writing class and creating objects consisting of other objects. Write a program that create an array of 10 Rectangle objects. A Rectangle object is defined by two points: the upper left and the lower right points. They represent the upper left corner and the lower right corner of a rectangle. With those two points, we can determine the other two points, the width, and the height of the rectangle. A point is defined by the value \( \mathrm{x} \) and \( \mathrm{y} \) which are of type double. Main class Random rectangles Here's the code I used to generate the value of \( X \) and \( Y \) for the points. lowX is the \( x \) value of the left side of the rectangle and Here's the code I used to generate the value of \( X \) and \( Y \) for the Dinint Low \( X \) is the \( X \) value of the left side of the rectangle and high \( X \) is the fialue of the right side of the rectangle. low \( Y \) is the \( y \) value of the bottom side of the rectangle and highY is the top side of the rectangle. Notice that low \( X \) is less than high \( X \) and lowY is less than highY. The rectangles will have height and width between 1 and 5 . int lowX \( = \) r.nextInt \( (5)+1 \); int highX \( =1 \) owX \( + \) r.nextInt \( (5)+1 \); int lowY \( = \) r. nextInt \( (5)+1 \); int highY \( = \) lowY \( + \) r.nextInt \( (5)+1 \);


We have an Answer from Expert

View Expert Answer

Expert Answer


// Point.java for representing Point class class Point { private double x; private double y; public Point(double x, double y) { this.x = x; this.y = y
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe