Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java please. All classes are given, if not please request for it. Show answers code and result. Exit class import javafx.geometry.Point2D; public class Exit

In Java please. All classes are given, if not please request for it. Show answers code and result. image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Exit class

import javafx.geometry.Point2D; public class Exit { private Point2D location; // The row/column coordinate of the exit in the building public Exit(int r, int c) { location = new Point2D(r,c); } public Point2D getLocation() { return location; } public void setLocation(Point2D newLoc) { location = newLoc; } public boolean isAt(int r, int c) { return (location.getX() == r) && (location.getY() == c); } } 

Room class

import javafx.geometry.Point2D; public class Room { private static final int MAX_ROOM_TILES = 400; private int numTiles; // The number of tiles that make up a Room private Point2D[] tiles; // All the tiles that make up a Room private int colorIndex; // The color index of the Room public Room() { tiles = new Point2D[MAX_ROOM_TILES]; numTiles = 0; colorIndex = 0; } public int getColorIndex() { return colorIndex; } public int getNumberOfTiles() { return numTiles; } public void setColorIndex(int c) { colorIndex = c; } // Add a tile to the room (up until the maximum) public boolean addTile(int r, int c) { if (numTiles  

Building class

public class Building { public static final int MAXIMUM_FLOORPLANS = 5; public static final int MAXIMUM_EXITS = 8; private FloorPlan[] floors; // The floorPlans of the building private int numFloors; // The number of floorPlans in the building private Exit[] exits; // The Exits of the building private int numExits; // The number of Exits in the building public Building(int fCount, int eCount) { floors = new FloorPlan[Math.max(MAXIMUM_FLOORPLANS, fCount)]; numFloors = 0; exits = new Exit[Math.max(MAXIMUM_EXITS, eCount)]; numExits = 0; } // Get/set methods public Exit[] getExits() { return exits; } public Exit getExit(int i) { return exits[i]; } public FloorPlan[] getFloorPlans() { return floors; } public FloorPlan getFloorPlan(int i) { return floors[i]; } // Get the exit at this location public Exit exitAt(int r, int c) { for (int i=0; i 

Floor plan

public class FloorPlan { private static final int MAX_ROOMS= 12; private String name; // name of the floor plan private int size; // # of rows and columns in table private boolean[][] walls; // Grid indicating whether a wall is there or not private Room[] rooms; // Rooms defined in the floor plan private int numRooms; // Number of rooms defined in the floor plan // Yep, this is a constructor. It assumes that floorplans are always square in shape public FloorPlan(int rw, String n) { name = n; size = rw; walls = new boolean[size][size]; rooms = new Room[MAX_ROOMS]; numRooms = 0; // Set the grid to have empty space inside, but walls around border for (int r=0; r  (1) The Model classes The main class that represents the model is a Building object. Each building contains various FloorPlan objects which contain Room objects. Buildings also have Exit objects. The picture on the right shows a single FloorPlan which contains 4 colored Room objects. The 3 red squares represent the Building's Exits. The white areas are corridors on that floor. Since the goal of this assignment is to create an application with a resizable user interface that allows the user to create floor plans in a building, all of the model classes are given to you as completed. Please make sure that you understand all of the code that you are given here. You MUST NOT add any code to these model classes, nor change any of it. You MUST hand in these unaltered model classes along with your assignment. An Exit objectis simply a 2D point represented by a (row, column) coordinate with respect to the Building

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

Mastering Apache Cassandra 3 X An Expert Guide To Improving Database Scalability And Availability Without Compromising Performance

Authors: Aaron Ploetz ,Tejaswi Malepati ,Nishant Neeraj

3rd Edition

1789131499, 978-1789131499

More Books

Students also viewed these Databases questions