java语言写常驻服务,深夜了,我正式加入java吧,当个常驻选手!!!

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

rogramming Assignemnt 2

1. In this PA, you need to apply state pattern to implement the following requirements from PA1:

Northwest Airlines want to develop a new system for the WorldPerks program. In this program, each passengerhas one unique WorldPerks number plus their name. There is three types of status for each passenger who joins the program: normal, silver, and gold. After travelling with NWA, the system should update the mileage for the passenger as follows: 1) Normal passenger: update the mileage by the actual travel miles; 2) Silver passenger: update the mileage by 1.5 * the actual travel miles; 3) Gold passenger: update the mileage by 2 * the actual travel miles.

and you also consider the following requirements:

The status of a customer can be changed by calling methods upgrade() or downgrade(). When a change is made, the status of a customer is either upgraded or downgraded by one level. The upgrade relation between these status is normal -> silver -> gold while the downgrade relationship is opposite. The initial status of a customer is normal. After the status of a customer is updated, the mileage computation is based on the above requirements given for PA1. Also, method update() can take a negative integer to decrease the mileage based on the above requirements.

2. To implement the above requirements, you need to have the following requirements

Using Eclipse/Java to implement the above program; Using a class diagram to show the structure of your program; Avoid any usage of conditional statements in your program. Use requires and effects clauses to specify each method.

3. How to test your program. The PA2_INPUT file is used to test your program. So your program structure should be compatible with the test file.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值