Java代写: CS107 Hotel Booking Application

Introduction

Hotel booking application,在软件工程中叫做Hotel reservation system,也就是酒店管理系统。这类系统的开发工作量,主要是根据需求,来实现其业务逻辑部分。
一个成熟的酒店管理系统,还可以接入或被接入其他系统。只要做好接口设计,给出稳定、可拓展的接口,这类系统便可以反复利用。
当然,对于酒店管理系统的重构,也是十分头疼的一件事。由于要逐个梳理需求,在重构中要避免需求的落下。

Requirement

Below are the features of this project that you should implement in this course.

  1. As a user, he can login with a username and password and launch the hotel booking application.
  2. As a user, he can search available rooms in the hotel by entering a departure date, and book the standard room, big bed room or business suite room.
  3. As a user, he can display search results sorted by floor, cost and date.
  4. As a user, he can cancel the reservation room.

This application will use a txt file to load the user’s information. The file should contains the following properties:
LastName, FirstName, Gender, Age, Email, CreditCardNumber, BillingAddress, ExpriyDate.

Analysis

本次作业需要实现酒店管理系统的一部分业务功能,即用户使用部分,包括了用户登录、预订查询、查询排序、预定房间和预订取消等功能。代码的实现需要结合所给出的框架来完成,因此熟悉框架的结构成为了一个不可缺少的过程。
需要注意的是,对于此类系统,一个通用的设计模型是:先判断传入参数和合法性,再判断是否拥有执行权限,最后再做相关业务逻辑。

Tips

下面给出emailAddress地址的业务逻辑代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
public class Driver {
public static boolean validateEmailAddress(String emailAddress) {
if (emailAddress == null || emailAddress.equals("")) {
return false;
}
Pattern p = Pattern.compile("\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*");
Matcher m = p.matcher(emailAddress);
return m.matches();
}

public static String getEmailAddress(String emailAddress) {
if (validateEmailAddress(emailAddress) == false) {
throw new EmailException(emailAddress);
}
// do business logic
...
}
}