Q3) Write a Java program that fulfill the following state diagram: Room - WindowNum: int - length: double - width: double + Room(int, double, double) + setWindowNum(int) : void + getWindowNum () : int...


Java program


Q3) Write a Java program that fulfill the following state diagram:<br>Room<br>- WindowNum: int<br>- length: double<br>- width: double<br>+ Room(int, double, double)<br>+ setWindowNum(int) : void<br>+ getWindowNum () : int<br>+ setLength(double) : void<br>+ getLength(): double<br>+ setWidth(double) : void<br>+ getWidth() : double<br>+ computeArea(): double<br>Then:<br>1) Add a public class constant which set the maximum area to 40.0<br>2) Add another constructor with no parameters.<br>3) Add the main method to the class Room and define at least three objects, named r1, r2, and r3.<br>4) From the main method, test if r1, r2, and r3 have larger area than the class constant or not, and<br>print

Extracted text: Q3) Write a Java program that fulfill the following state diagram: Room - WindowNum: int - length: double - width: double + Room(int, double, double) + setWindowNum(int) : void + getWindowNum () : int + setLength(double) : void + getLength(): double + setWidth(double) : void + getWidth() : double + computeArea(): double Then: 1) Add a public class constant which set the maximum area to 40.0 2) Add another constructor with no parameters. 3) Add the main method to the class Room and define at least three objects, named r1, r2, and r3. 4) From the main method, test if r1, r2, and r3 have larger area than the class constant or not, and print "Big Room" or "Small Room", accordingly.

Jun 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here