Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

OK i am a bit lost at this, I have this protject and not sure how to build the l

ID: 3789338 • Letter: O

Question

OK i am a bit lost at this,

I have this protject and not sure how to build the layout for it, if somone could explain for me the setup and maybee some hints about how to solve this,

Project below

A Company is in charge of Student Campus. Its role is to offer students convenient and well-placed housing at a fair price.

Campus Center has allocated 3 apartments for this project, but you are to help build a computer model to simulate conditions.

Create a class called CampusUnit, with the attributes Size (square meters - size of the unit), Bedrooms (number of bedrooms in the unit) and Occupants (current number of occupants), all integer variables, all private attributes.

Provide default constructor that sets all attributes to zero, plus a constructor where you can specify all attributes.

The simulation will first initialize three instances of the CampusUnit class by asking the user to input the variables (square meters, bedrooms and occupants).

Next it will use overloaded addition operator that you provide for the class, to sum up the total size, bedrooms and occupantsin of all three instances and assign it into a new instance, i.e.

cuTotal = cu0 + cu1 + cu2;

Then add a method Future, which prints out how many occupants could live in a unit space with the attributes of the instance, according to sustainable goals :

Bathrooms: 8 square meter,
Kitchens / dining area: 16 square meters,
- The rest can be divided into 8 square meter multi function bedroom / living area for two persons.

Example: 100 square meters unit, 24 square meters go to kitchen + bathroom, then there is room for 9 bedroom/living areas for up to 18 occupants, with whole 4 square meters to spare for luxary such as closet space or corridors.

Use this method to print out how the Campus space could be better utilized for the three pilot units (cu0..cu2), and of course for the cuTotal - which shows the utilization if all three where combined;

Explanation / Answer

The question says that you have to design a simulation for allocating apartments/rooms as residential places for students. You have 3 separate apartments, denoted by 3 separate instances of the class CampusUnit. These instances are created by the user. All the operations are done on these three apartments/instances and a fourth apartment/instance which represents the sum of these three (represented by cuTotal) i.e. a bigger apartment which has the size of the three instances combined.

The basic layout of the project would be:
There will be one public class, called CampusUnit. It would have the following attributes-
1. Variables -
It would have 3 private (int) variables - size (denoting the size of the apartment), bedrooms (denoting the number of bedrooms present in the apartment) and occupants (denoting the current number of occupants in the apartment). Please note that these values are given by the user and may not necessarily denote the optimum values (as per the sustainable goals). We will output the optimum values through the function Future().

2. Functions-
Class CampusUnit would have two constructors - one default and the other which initializes values of the private members of the class.
The class would also have two other functions- Addition and Future. The purpose of these functions is given in the question. They are discussed in detail later.

3. Main() method-
The class would have main() method from where execution would start.

The purpose of the constructors is self-explanatory. Let's focus on the remaining two functions- Addition and Future.
Addition-
This functions takes input as 3 instances of the class CampusUnit(cu0, cu1 and cu2) and returns an instance of class CampusUnit (cuTotal). cuTotal represents an apartment which is a combination of the three instances, i.e., it's size is the sum of their sizes, it's number of bedrooms and occupants are the sum total of the bedrooms and occupants of the three instances respectively.
Future-
This function predicts the optimum number of bedroom/living spaces and occupants for the given apartment. The description says that every apartment would compulsorily have a kitchen and a bathroom. The rest of the space would consist of bedrooms/living spaces of size 8 sq. m each, with each containing 2 occupants. There can also be additional space left after creating the bedroom, kitchen and bathroom.
Here's a sample Java code for the same. Please note that the values here are hardcoded. In the simulation, the values have to be provided by the user. So in the main method, take 3 separate inputs from the user, denoting the 3 separate apartments/instances.

public class CampusUnit
{
private int size, bedroom, occupants;

CampusUnit()
{
     size = bedroom = occupants = 0;
}

CampusUnit(int s, int b, int o)
{
     size = s;
     bedroom = b;
     occupants = o;
}

CampusUnit addition(CampusUnit cu1, CampusUnit cu2, CampusUnit cu0)
{
     CampusUnit cuTotal = new CampusUnit(cu1.size+cu2.size+cu0.size,cu1.bedroom+cu2.bedroom+cu0.bedroom,cu1.occupants+cu2.occupants+cu0.occupants);
     return cuTotal;
}

void Future(CampusUnit cu)
{
     //This function prints the no of occupants that can occupy the unit instance, based on the sustainable goals
     if(cu.size<24)
     {
         System.out.println("No bedrooms are possible");
         return;
     }
     int bedroom_count = (cu.size-8-16)/8;
     int additional_space = (cu.size-8-16)%8;
     System.out.println("There is room for "+bedroom_count+" bedroom/living areas for up to "+bedroom_count*2+" occupants");
     System.out.println("There is additional space of "+additional_space+" square meters");
}

public static void main(String args[])
{
     //Initialize 3 instances. Ask user for input, this is a hardcoded example
     CampusUnit cu1 = new CampusUnit(100,7,14);
     CampusUnit cu2 = new CampusUnit(200,14,20);
     CampusUnit cu3 = new CampusUnit(300,25,60);
     CampusUnit cuTotal = cu1.addition(cu1, cu2, cu3); //The addition function could be from cu1, cu2 or cu3
     cu1.Future(cu1);
     cu2.Future(cu2);
     cu3.Future(cu3);
     cuTotal.Future(cuTotal);
}
}

Please let us know if you have any follow-up questions.