Giter Club home page Giter Club logo

ab-cjt2009-hotel's Introduction

ab-cjt2009-hotel

Домашно 1

Да се направи симулация на система за хотелски стаи. Трябва да имате следните класове:

Room, който има следните полета:

  • int number; // номер на стаята
  • int capacity; // колко гости събира
  • float rate; // колко е тарифата

Guest, който има следните полета:

  • String name;
  • String email;

Следва интерфейса за хотел който вие тряабва да имплементирате в клас наречен MyHotel:

package cjt2009.homework1;

import java.io.File;
import java.util.Collection;

/**
* Basic interface for your hotel
* 
* @author Vesko Georgiev
*/
public interface Hotel {

/**
* Fills the hotel with the passed collection of rooms.
* 
* @param rooms the rooms to fill the hotel with
*/
public void populateRooms(Collection<Room> rooms);

/**
* Settles the passed guests in the first available room considering its capacity.
* 
* @param guests guests to settle
* @return the first room available
* @throws NoAvailableRoomException if there is no available room 
*/
public Room rentARoom(Collection<Guest> guests) throws NoAvailableRoomException;

/**
* Settles the passed guests in the first available room considering its capacity, and its rate.
* 
* @param guests guests to settle
* @param rate rate of the room to rent
* @return the first room available
* @throws NoAvailableRoomException if there is no available room
*/
public Room rentARoom(Collection<Guest> guests, float rate) throws NoAvailableRoomException;

/**
* Returns all available rooms
* 
* @return all available rooms, or null if there are aren't
*/
public Collection<Room> getAvailableRooms();

/**
* Returns guests that are staying in room with the passed number
* 
* @param roomNumber the room to search the guest in 
* @return the guests that are staying in room with the passed number, or null if the room is available 
*/
public Collection<Guest> getGuestInRoom(int roomNumber);

/**
* Returns the room, which the passed guest is staying in.
* 
* @param guest the guest to search the room for
* @return the room, which the passed guest is staying in, -1 if this guest
* is not in the hotel.
*/
public int getRoom(Guest guest);

/**
* Stores the rooms of the hotel, and their current state,
* e.g. if they are available or if not who is staying in.
* 
* @param f the file to write the information in.
* @return true if the store has passed successfully and false otherwise
*/
public boolean store(File f);

/**
* Loads the rooms of the hotel, and their stored state,
* e.g. if they are available or if not, who is staying in.
* 
* @param f the file to load from
* @return true if the load has passed successfully and false otherwise
*/
public boolean load(File f);
}

NoAvailableRoomException съответно трябва да си го напишете. Спазвайте иментата на класовете както съм ги написал, тъй като ще ви пускам решенията на автоматични тестове. Също така, моля поставете всички класове в пакет наречен: cjt2009.homework1; т.е. пакета, в който съм дефинирал интерфейса Hotel.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.