Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA array problem ResortManagement /* CS141 Assignment 21 Start file * * Part 1 * * This program is an object file that is designed

JAVA array problem

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

ResortManagement

/* CS141 Assignment 21 Start file * * Part 1 * * This program is an object file that is designed to * manage a resort of building and their available rooms. */

/* Students should not modifiy this file, but add the * neccessary object files to implement it */ /* Also this file contains methods/algorithms that you may * want to copy when completing part 2. Permission is given * for this assignment to plagerize this work to help you * with part 2. */ import java.util.Scanner;

public class ResortManagement { public static void main(String[] args) { Building[] resort = new Building[4]; resort[0] = new Building('A', 5, 150); resort[1] = new Building('B', 4, 250); resort[2] = new Building('C', 6, 100); resort[3] = new Building('D', 10, 75); runLoop(resort); } public static void runLoop(Building[] resort ) { boolean keepGoing = true; Scanner keyboard = new Scanner(System.in); while(keepGoing) { System.out.println("What would you like to do?"); System.out.println(" 1. Rent a room?"); System.out.println(" 2. Check out a room?"); System.out.println(" 3. Print a summary"); System.out.println(" 4. Print a large overview"); System.out.println(" 0. Quit"); int x = keyboard.nextInt(); if(x == 1) {rentARoom(resort, keyboard) ;} else if(x == 2) { checkOutOfARoom(resort, keyboard); } else if(x == 3) {printResortSmallStatus(resort); } else if(x == 4) {printResortLargeStatus(resort); } else if(x == 0) {keepGoing = false;} else {} try {Thread.sleep(500);} catch(InterruptedException ex) {Thread.currentThread().interrupt();} } } public static void checkOutOfARoom(Building[] resortList, Scanner in) { printOccupiedRooms(resortList); System.out.println("What Room would you like to check out?"); String room = in.next().toUpperCase(); checkout(resortList, room); } public static void rentARoom(Building[] resortList, Scanner in) { System.out.println("What building would you like to rent from?"); char let = in.next().toUpperCase().charAt(0); int num = let - 'A'; rentRoom(resortList, num); } public static void printOccupiedRooms(Building[] resortList) { System.out.print("The currently occupied rooms are : "); for (int i = 0; i = 0 && buildingNumber

} public static void printResortLargeStatus(Building[] resortList) { System.out.println("**********Expanded Status of the Resort*******"); for (int i = 0; i

}

ResortManagement2

/* CS141 Assignment 21 Start file * * Part 2 * * This program is an object file that is designed to * manage a resort of building and their available rooms. */

/* Students should not modifiy this file, but add the * neccessary object files to implement it * * This file assumes that you completed part 1 and have the * room and building classes done, and are ready to * implement the resort class. * */ import java.util.Scanner;

public class ResortManagement2 { public static void main(String[] args) { Resort myResort = new Resort(4); myResort.setBuilding(0,'A', 5, 150); myResort.setBuilding(1,'B', 3, 166); myResort.setBuilding(2,'C', 7, 250); myResort.setBuilding(3,'D', 10, 750); runLoop(myResort); } public static void runLoop(Resort resortVar ) { boolean keepGoing = true; Scanner keyboard = new Scanner(System.in); while(keepGoing) { System.out.println("What would you like to do?"); System.out.println(" 1. Rent a room?"); System.out.println(" 2. Check out a room?"); System.out.println(" 3. Print a summary"); System.out.println(" 4. Print a large overview"); System.out.println(" 0. Quit"); int x = keyboard.nextInt(); if(x == 1) { System.out.println("What building would you like to rent from?"); char let = keyboard.next().toUpperCase().charAt(0); resortVar.rentRoom(let); } else if(x == 2) { resortVar.printOccupiedRooms(); System.out.println("What Room would you like to check out?"); String room = keyboard.next().toUpperCase(); resortVar.checkout(room); } else if(x == 3) { resortVar.printResortSmallStatus(); } else if(x == 4) { resortVar.printResortLargeStatus(); } else if(x == 0) { keepGoing = false; } else {} try {Thread.sleep(500);} catch(InterruptedException ex) {Thread.currentThread().interrupt();} } } }

CS145 PROGRAMMING ASSIGNMENT 18 RESORT HOTEL OVERVIEW This assignment will give you practice with object, arrays and strings You are going to write a program that will maintain an active use of a number of different rooms at a resort, where each room is part of a particular building To begin with, you will be writing the methods for two of the classes that will allow the program to work. This first part is the primary goal of the assignment and account for80% of the grade. The second part of the assignment has you "fixing" the program to sert an object that should have been there all along BACKGROUND A modern resort tends to not have a single building with rentable rooms, but rather a series of building, each with its own set of rooms. We want to be able to write a program to maintain an active directory of which rooms are occupied currently, which are empty, be able to rent out a room, and be able to state when the occupants have checked out of a room For the purposes of this assignment, we are going to assume that each building is given a character name and a number of rooms, and a price per room. Each room of that building will be assumed to be the same price. So for example Building 'A' might have 5 rooms each at a price of $150.00 a night. While building 'D' might have 10 rooms at a price of $75.00 a night. We will want to keep track of the data using the ResortManagement.java file as the primary client and building the companion files Building. java and Room. java The main program will then run a loop to allow us to check in (rent a room check out (be done with a room and getting data from the files PART 1 For the first part of this assignment, you will be creating two classes that work with ResortManagement.java file to implement the necessary files. You are not to adjust/alter ResortManagement.java in any way. You will need to implement the two classes Building.java and Room.Java. Their UMLs are below and a text description follows

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

Database And Expert Systems Applications Dexa 2023 Workshops 34th International Conference Dexa 2023 Penang Malaysia August 28 30 2023 Proceedings

Authors: Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil ,Bernhard Moser ,Atif Mashkoor ,Johannes Sametinger ,Maqbool Khan

1st Edition

303139688X, 978-3031396885

More Books

Students also viewed these Databases questions

Question

Explain in detail how the Mughal Empire was established in India

Answered: 1 week ago

Question

Problem: Evaluate the integral: I - -[ze dx

Answered: 1 week ago