Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA homework(netbeans) In this homework you are going to implement a Room class that has the following private attributes: name : The name of the

JAVA homework(netbeans)

In this homework you are going to implement a Room class that has the following private attributes: name : The name of the room ( i.e. bedroom, bathroom, kitchen etc.) size: The size of the room in squaremeters (integer) windowCount: The number of windows in the room (integer) heated: A flag denoting if the room has some heating equipment(boolean) Your class should include appropriate constructors , getters and setters as public. When ,for example,Room r1 with size s, windowCount w, is converted to string and printed out with System.out.println, the text should be as: name [size m^2] with w window with/without heating You are also supposed to implement an Apartment class that contains a name and 4 rooms (namely room1, room2, room3, and room4) as members. The Apartment class should have the following public methods Constructor taking 4 rooms as parameters toString(): prints the name of the apartment and all of the rooms line by line (calling toString() methods of Rooms ) smallestRoom(): returns the smallest room in the market isHeated(): returns true if at least 2 of the rooms are heated, false otherwise getTotalSize(): returns the total size of the apartment (sum of the sizes of the rooms). After implementing Room and Apartment classes you must write a third class (give any name) that only includes a main function. In the main function, create at least 4 arbitrary Room object and create an Apartment object containing 4 of those rooms as members. Print out the apartment and total size of the apartment. Call each method of the apartment class in the main function.

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

Database Programming Languages 12th International Symposium Dbpl 2009 Lyon France August 2009 Proceedings Lncs 5708

Authors: Philippa Gardner ,Floris Geerts

2009th Edition

3642037925, 978-3642037924

More Books

Students also viewed these Databases questions