Program 3: Gianforte Hall Stack Builder

Due Date and Submission Requirements


The goal of this lab is:


Background and Directions

Gianforte Hall is the brand new computer science building that is slated to begin construction next year.

In this assignment, you will write a program that allows a user to "build" the different floors of Gianforte Hall, however the administration of MSU has placed some restrictions on the building plans. Each floor of the building can only fit one room, and the building can not be taller than 10 floors high.

There are three types of rooms/floors in Gianforte Hall. A classroom, which hosts a class offered by school of computing (CSCI 132, CSCI 246, etc), A faculty office, which houses one faculty member, and a research lab, which is used for a type of research program (Cyberscutiy, Artificial Intelligence, Computational Biology, etc).

You will use a stack data structure to represent the building. Your stack MUST be implemented using an array. New floors are added to the top of the building, and to remove a floor, you must always remove the very top floor. Your stack must store Floor objects (you will need to write the Floor class). Each Floor has a floor number, floor type (classroom, office, lab), and some information about that floor (class offered, professor, or research type).

Your program will have a menu where a user can select different types of functions to perform.

1. View Current Building plan- Your program needs to have a function that will print each floor of the building. Each floor should include the floor number, and what type of room is on that floor (classroom, office, or lab). Sample output
2. Add a new floor- This method will allow a user to add a new floor to the building. It will prompt the user what type of room they want to add, and the information for that room (class name, professor name, or research type). When a new floor is made, it must always be added to the top of the building. If the building currently has 10 floors, your program should not allow the user to add another floor. Sample output
3. Demolish top floor - This method will demolish whatever the top floor currently is, and remove that floor from the stack. Sample output
4. Search for a classroom- Given the name of some class (ie CSCI 132), this method will tell the user what floor that class is offered on. If the class is not offered in Gianforte hall, then the program should print out "(class_name) is not offered in Gianforte Hall". Sample output
5. View Building Information- This method prints out the current number of classrooms, offices, and research labs in Gianforte Hall. Sample output
6. Exit Program - If the user selects menu option 6, the program should end.

Starting Code and Requirements

You are welcome to develop your solution from scratch, but you must have a Demo class, a Stack class, and a Floor class. You must implement your own Stack data structure, and your stack must use an Array. You are now allowed to use any arraylists or linked lists. Here is a demo class that might help you get started: Program3Demo.java . You are welcome to modify or change this class.

Restrictions

Sample Output

Your program does not need to match this output exactly, but it should be pretty close.
Sample output

Optional Hints

Look back at our code from March 22 for how to implement a stack data structure with an array.

If you get stuck or have a bug in your code, remember that you a rubber duck that can help 😉

Grading (100 points)

Requirement Points
Your program uses a stack (Array) to hold Floor objects. 30
Your program can print out the current floors of the building (Menu option #1) 10
Your program can add a new floor to the top of the building (Menu option #2). If the building is already 10 floors high, the program does not allow the user to add another floor 15
Your program can demolish the top floor of the building (Menu option #3) 10
Your program can search for a class, and the program returns the floor number of the classroom the course is offered in. If the class is not offered in the building, your program should print that out (Menu option #4) 15
Your program prints out the number of classrooms, labs, and offices in the building (Menu option #4) 10
The Floor class is correctly defined 10






program 3 solution