A block of flats has 27 floors with ten flats on each floor. Each flat has six rooms. Find and print the following: The total area for each flat (print this value and the floor and flat numbers). The total area for each floor (to be stored in a one-dimensional array and printed at the end of processing). Print the contents of this array with the respective floor numbers. The total area for the building. The area of each room must be loaded into the array.
package HomeworkLib1;
public class Room{
int area;
Room(int area){
super();
this.area = area;
}
}
package HomeworkLib1;
public class Flat {
Room[] rooms;
int flatNo;
int area;
Flat(int j){
this.flatNo = j;
rooms = new Room[6];
for(int i=0; i<rooms.length; i++) {
rooms[i] = new Room(4*i+6); //populating some values
}
this.area = 0;
for(int i=0; i<rooms.length; i++)
this.area += rooms[i].area;
}
}
package HomeworkLib1;
public class Floor {
Flat[] flats;
int floorNo;
int area;
Floor(int x){
this.floorNo = x;
flats = new Flat[10];
for(int i=0; i<flats.length; i++) {
flats[i] = new Flat(this.floorNo*10 + (i+1));
}
this.area = 0;
for(int i=0; i<flats.length; i++)
this.area += flats[i].area;
}
}
package HomeworkLib1;
public class Building {
Floor[] floors;
int area;
Building(){
floors = new Floor[27];
for(int i=0; i<floors.length; i++) {
floors[i] = new Floor(i+1);
}
this.area = 0;
for(int i=0; i<floors.length; i++)
this.area += floors[i].area;
}
public static void main(String[] args) {
Building b = new Building();
for(int i=0; i<b.floors.length; i++) {
System.out.println("Floor no: " + b.floors[i].floorNo + " Area: " + b.floors[i].area);
}
System.out.println("Total area: " + b.area);
}
}

A block of flats has 27 floors with ten flats on each floor. Each flat has...
There are three floors in a hospital. Each floor has five wards. Each ward can contain a maximum of 20 patients. This is a twodimensional array, storing an integer value representing the number of patients in a ward. Once the numbers of patients in each ward have been input into an array, determine and print the following: Which ward on which floor has the most patients? Which floor has the highest number of patients? Include a check to ensure the...
There are 10 floors in a hotel (numbered from 0 to 9). On each floor there are 26 rooms, each marked with a capital letter of the English alphabet (from "A" to "Z"). Your task is to compute which room was booked most frequently, based on a list of room reservations. The list of reservations consists of N three-character strings. The first character of the string is "+" or "−", which describes whether the room was booked or freed. The...
The project aims to design a network for a casino. The casino has 10 floors including the ground floor. The ground floor has a lobby area. Each floor also has a lobby area. There are 40 rooms in each floor, each of which has a network point to which the guest PC is connected. The casino network has two servers which are used by the staff. A high speed internet connection is available which is to be shared by the...
/*hello everyone. my question is mostly related to the garagetest part of this assignment that i've been working on. i am not sure how to read the file's contents AND put them into variables/an array. should it be in an arraylist? or maybe a regular array? or no arrays at all? i am also not sure how to call the factory method from garagec. i'm thinking something along the lines of [Garage garage = new GarageC.getInstance("GarageC", numFloors, areaofEachFloor);] but i...
java
Binary files The binary file data.dat contains characters and numbers- it has 16 characters, followed by numbers of type int alternating with numbers of type double -so after the first 16 characters, there will be an int, followed by a double, followed by an int, followed by a double, and so on. Write a program to open the file and until the end of file is reached, read in the values in the appropriate data types (that is, read...
Solve it for java
Question Remember: You will need to read this assignment many times to understand all the details of the you need to write. program Goal: The purp0se of this assignment is to write a Java program that models an elevator, where the elevator itself is a stack of people on the elevator and people wait in queues on each floor to get on the elevator. Scenario: A hospital in a block of old buildings has a nearly-antique...
write a C++program to analyze a small subset of the data that has been collected. See file universities.txt .Use precisely seven parallel arrays: one for name of university, one for state, one for city, one for yearly tuition, one for enrollment, one for average freshman retention, and one for the percent of students who graduate with in six years. Note that the percentage of student accepted is not stored.An output file is opened in main() and remains open until the...
Please!!! need help asap!!!! write a C++program to analyze a small subset of the data that has been collected. See file universities.txt .Use precisely seven parallel arrays: one for name of university, one for state, one for city, one for yearly tuition, one for enrollment, one for average freshman retention, and one for the percent of students who graduate with in six years. Note that the percentage of student accepted is not stored.An output file is opened in main() and...
e. 18 Test Your Knowledge MULTIPLE CHOICE: Choose the one best answer. 1. Each element has its own characteristic atom in which a. the atomic mass is constant. b. the atomic number is constant. c. the mass number is constant. d. Two of the above are correct. e. All of the above are correct. 2. Which of the following is not a trace element in the human body? a. iodine b. zinc c. iron d. calcium e. fluorine 3. A...
pleas help me in this do any question you know using National
Electrical Code 2011
Applied Electricity NEC worksheet t hree Copper conductors with THHN insulation run in Electrical A branch-circuit Consther conductors. The conductor terminations are rated for a maximum ure in the area of this installation is not expected to exceed 30C size 8 AWG, the maximum ampacity of the conductors If the conductors for this circuit are permitted A 40 amperes. B. 50 amperes. to be used...