subject
Engineering, 16.04.2021 08:50 hanhann6895

Using only try java : Implement the class as depicted in the UML diagram.
Apartment

-city: String
-area: double
-nbOfRooms: int
-duplex: boolean
+num_apt: int
+Apartment(All data fields)
+getCity(): String
+getNumberOfStories(): int
+assessSize(): String
+printDescription(): void

Data Fields:
1. city: It may consist of one word or two such as “Beirut”, “Bint Jbeil”, etc.
2. area: its value is expressed in square meter
3. nbOfRooms: with maximum value of 10
4. duplex: either true or false to reflect whether the apartment is made of two stories or only a single one.
5. num_apt: to keep track of how many apartment objects were created.
Methods:
1. A constructor that creates an Apartment object with the specified values of all data fields. If the number
of rooms passed is greater than 10, then nbOfRooms is set to 0.
2. getCity(): this method returns the city with its letters all capitalized.
3. getNumberOfStories(): This method returns the number of stories of an apartment. If it is duplex, then 2
is returned otherwise 1 is returned.
4. assessSize(): This method returns “Spacious” if the area is greater than 150 square meter, “Small” if it is
less than 100 and “Medium” otherwise.
5. printDescription(): Method that displays the information of the apartment as in the following examples:

Example 1 Spacious 2 stories Apt in HAMRA - 250.0 (sqm) - 6 room(s)
Example 2 Small 1 story Apt in ZAHLE- 50.0 (sqm) - 1 room

Question 2 [30 points]:
Implement a client class to test the Apartment class as follows:
1. Create an array of Apartment objects of size 5.
2. Fill it with five Apartment objects according to your choice as a programmer (NOT from the user)
3. Print the description of all apartments in the array which are located in “Beirut”
4. Display the size assessment of each apartment in the array.
5. Display the city of all apartment objects that are formed of two stories

ansver
Answers: 2

Another question on Engineering

question
Engineering, 04.07.2019 18:10
Apump is used to circulate hot water in a home heating system. water enters the well-insulated pump operating at steady state at a rate of 0.42 gal/min. the inlet pressure and temperature are 14.7 lbf/in.2, and 180°f, respectively; at the exit the pressure is 60 lbf/in.2 the pump requires 1/15 hp of power input. water can be modeled as an incompressible substance with constant density of 60.58 lb/ft3 and constant specific heat of 1 btu/lb or. neglecting kinetic and potential energy effects, determine the temperature change, in °r, as the water flows through the pump.
Answers: 1
question
Engineering, 04.07.2019 18:10
Abrake has a normal braking torque of 2.8 kip in and heat-dissipating cast-iron surfaces whose mass is 40 lbm. suppose a load is brought to rest in 8.0 s from an initial angular speed of 1600 rev/min using the normal braking torque; estimate the temperature rise of the heat dissipating surfaces.
Answers: 3
question
Engineering, 04.07.2019 18:10
You are making beer. the first step is filling the glass carboy with the liquid wort. the internal diameter of the carboy is 15 in., and you wish to fill it up to a depth of 2 ft. if your wort is drawn from the kettle using a siphon process that flows at 3 gpm, how long will it take to fill?
Answers: 1
question
Engineering, 04.07.2019 18:20
A3-mm-thick panel of aluminum alloy (k 177 w/m-k, c 875 j/kg-k and ? = 2770 kg/m) is finished on both sides with an epoxy coating that must be cured at or above t,-150°c for at least 5 min. the production line for the curing operation involves two steps: (1) heating in a large oven with air at ts,0-175°c and a convection coefficient of h, 40 w/m2. k, and (2) cooling in a large chamber with air at 25°c and a con- vection coefficient of he 10 w/m2.k. the heating portion of the process is conducted over a time interval te which exceeds the ime required to reach 150°c by 5 min (h = r + 300 s). the coating has an emissivity of ? = 0.8, and the temperatures of the oven and chamber walls are 175 and 25°c, respectively. if the panel is placed in the oven at an initial temperature of 25°c and removed from the chamber at a safe-to-touch tempera ture of 37°c, what is the total elapsed time for the two-step curing operation?
Answers: 3
You know the right answer?
Using only try java : Implement the class as depicted in the UML diagram.
Apartment
Questions
question
Mathematics, 25.02.2021 22:20
question
Mathematics, 25.02.2021 22:20
question
Mathematics, 25.02.2021 22:20
question
Mathematics, 25.02.2021 22:20
question
Mathematics, 25.02.2021 22:20
question
Mathematics, 25.02.2021 22:20
Questions on the website: 13722367