Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

User To all Comp2310 students (All Sections), Many of you asked about the methods moveChairForward/Backward. You should implement those by simply subtracting/adding the distance passed

User
To all Comp2310 students (All Sections),
Many of you asked about the methods moveChairForward/Backward. You should implement those by simply subtracting/adding the distance passed to the method from/to the Chair property distanceFromFrontWall. You are not required to use those methods in your Driver class, but you should have them implemented anyways.
Also, when you use a certain SEEDVALUE (e.g. 4), your program should produce the exact same output each time it is run as long as you do not change the value (i.e same number of chairs from each color, same room length, same room width, ...). When you change the value (e.g. 8), your program should start showing a new different output from the first but should be the same each time you rerun the program with that same new SEEDVALUE.
Hope that helps.
Regards,
Course coordinator
image text in transcribed
image text in transcribed
image text in transcribed
Given the following UML diagram for class Chair: Plcase do the following: 1. Create a class file called Chair.java that implements the UML. displayed above cxactle as seccifict (same variable names, types, ...). Also, make sure that the no-arg constructor calls the all-argument constructor and provides default values for the properties. 2. Create a class file called Room.java that implements a class called Room that has the following properties and constructorsimethods: 1 Properties (All Private); number (int), length (double), width (double), array of type Chair called chairs. all-argument constructor that initializes all Room properties setterigetter methods for each of the properties above method displayRoominfo() which priats 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). Yeu sheuld ake cocute a UML diagram for this class ax doscribod helone. Properties (All Private): number (int), length (double), width (double), array of type Chair called chairs. all-argument constructor that initializes all Room properties setterigetter 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. 3- 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 3). 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 20 and 50 (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 distanceFromFront Wall, 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 all-argument Room constructor to set a number for each room (Use 201,202,203 sequentially in this case), a random number from 30.0 to 50.0 for room length, and a random number from 20.0 to 30.0 for room width. Use the Random class. Also set the room chairs using the array created in point a- above. displayRooms 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 displayRoomlnfo( to do that). The table should be organized as follows: Your Driver class should define a constant called SEEDVALUE which is the value of the seed to be used when seu create vour ebject of Random Tune to be used in all vour program. You should we the same created Random object (OVE OBJECT OVLY) with the same seed SEEDVALE) to senerate all the random vuluc described above (using the suitable methods in the Random class). NOT doing this steg correctly will cause wou to lose many points. 1- Using one of the free UML drawing tools (e.g. UMLet ), draw a complete UML. diagram for the Room class and insert an image of it in a Word file called room_umL.docx then put that file inside your project folder, In the UML. each student should replace the name of the properties length and width to length \#\#\#\# and width \#Hit" where \#\#\#\# is the last four digits of his/her university id number this is only done in the UML and nor in the implementation abovel. 2- Your project folder ( containing all your project files ( *.java files and file room_uml.doc ) should be compressed (rar) and saved as ass2 youridnumber your_Labsectionmumber.rar (for example if your student id number is 1221234 and your lab section is section 9 then the assignment project folder should be called ass2_1221234_s9.rar ). Tum in your assignment by replying to the course coordinator's message on ite under the lab meta section and attaching your project rar file (ass2_youridnumber_your_Labsection.rar). 3- You must include your full name, student id number, and lab section number in a comment at the beginning of each of your java code files. Late Assignments (even one minute late) will NOT be accepted for any reason

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beyond Big Data Using Social MDM To Drive Deep Customer Insight

Authors: Martin Oberhofer, Eberhard Hechler

1st Edition

0133509796, 9780133509793

More Books

Students also viewed these Databases questions

Question

Know how productivity improvements impact quality and value.

Answered: 1 week ago