我的酒店类的数组有些麻烦

我的酒店类的数组有些麻烦

本文介绍了我的酒店类的数组有些麻烦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我是这个网站的新手,但它看起来确实是一个我会更频繁访问的地方!


解决我的问题。

我正在使用BlueJ在java中创建一个酒店商务项目


课程如下:

酒店 - 优惠酒店的主要功能(即预订的客人,寻找房间等)

房间 - 用于决定房间是否有海景并存放客房内的客人。

Occupier - 有关占用房间的团体的信息,包括住宿晚数和晚餐吃晚餐的方法。


我已经完成了房间和住宿课程,没有任何问题。

我的垮台正在创建酒店课。

到目前为止,该课程有3个字段

展开 | 选择 | Wrap | Line数字

解决方案



请注意,房间不知道它在酒店阵列中的存储位置;你有点b $ b来帮助它w.r.t.有海景。假设一个Room类有两个方法(一个布尔变量的getter和一个setter)

展开 | 选择 | Wrap | 行号





好​​的,第二次尝试;让我们解释另一种方式(参见我之前的回复)。

这里是Room类的相关部分:

展开 | 选择 | Wrap | 行号

First of all I''m new to this site but it certainly looks like a place that i will be visiting more often!

Onto my problem.
I am creating a Hotel Bussiness project in java using BlueJ

The classes are as follows:
Hotel - Deals with the major functions of the hotel (i.e guests booking in, finding rooms etc.)
Room - Used to decide whether a room has a sea view and stores the guest that is in the room.
Occupier - For information about the group occupying a room with methods for amount of nights stayed and nights eaten dinner.


I have completed the Room and Occupier classes with no trouble at all.
My downfall is creating the hotel class.
The class has 3 fields so far they are

Expand|Select|Wrap|Line Numbers

解决方案

Note that a Room doesn''t know where it is stored in your hotel array; you have
to help it a bit w.r.t. having a sea view or not. Suppose a Room class has the
following two methods (a getter and a setter for a boolean variable)

Expand|Select|Wrap|Line Numbers



Ok, second try; lets explain the alternative way (see my previous reply).
Here''s the relevant part of a Room class:

Expand|Select|Wrap|Line Numbers


这篇关于我的酒店类的数组有些麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 09:51