Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Properties ( All Private ) : number ( int ) , length ( double ) , width ( double ) , array of type Chair
Properties All Private: number int length double width double array of type Chair called chairs.
allargument constructor that initializes all Room properties settergetter methods for each of the properties above method displayRoomInfo which prints a room's number, length, width, and total number of chairs in a room, as well as the number of chairs of each color red yellow, or white
You should also create a UML diagram for this class as described below.
Create a class file called Driver.java that implements the Driver class which should implement the following two methods:
main method which should create an array of room objects called rooms For this program, set the size of the array to exactly To initialize the property values for each room in array rooms, you should do the following:
a Create an array of chairs with a random number of chairs between and inclusive and add that number of Chair objects to the array. Each Chair object added to the array should be given the same default value for properties weight and dateManufactured. As for property distanceEromFrontWall, each chair should be given a random value that does not exceed the length of the room. For the property color, you should assign a random color out of the following three colors only red yellow, or white Use the Random class to do those.
b Use the allargument Room constructor to set a number for each room Use sequentially in this case a random number from to for room length, and a random number from to for room width. Use the Random class. Also set the room chairs using the array created in point a above.
displaxRooms method which takes an array of type Room as an argument and loops through it displaying the property values for each room in the array you should call the method displayRoomInfo to do that The table should be organized as follows:
tablenumberlength,width,total chairs,red,yellow,whiteeg:
Your Driver class should define a constant called SEEDVALUE which is the value of the seed to be used when you create your object of Random Type to be used in all your program. You should use the same created Random object ONE OBJECT ONLY with the same seed SEEDVALE to generate all the random values described above using the suitable methods in the Random class NOT doing this step correctly will cause you to lose many points.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started