ZBLOG

Manny, the Royal Service Station manager, is going to expand his services to include an automated car washing system. The customer chooses the type of wash and specifies the type of car. The system computes the fee and displays the amount due on a...

There are a few ways to modify the UML class diagram in Figure 6.21 to accommodate the new automated car washing system service. Here is one possible approach:

  1. Add a new class called “CarWash” to represent the automated car washing system.
  2. Add an association between CarWash and ServiceStation, indicating that the car wash is part of the service station.
  3. Add attributes to CarWash, such as “typeOfWash” (string) and “fee” (float), which represent the type of wash chosen by the customer and the fee for that wash.
  4. Add a method to CarWash called “computeFee”, which takes as input the type of wash and type of car, computes the fee based on some algorithm, and returns it.
  5. Add a control panel object to CarWash that displays the amount due and accepts payment from customers.
  6. Add an attribute to CarWash called “isBusy” (boolean), which indicates whether or not there is currently a car being washed.
  7. Modify the ServiceStation class to include a reference to the CarWash object, allowing customers to access this new service when they visit.

The resulting UML diagram might look something like this:

+------------------+       +------------------+
|   ServiceStation  |       |      CarWash     |
+------------------+       +------------------+
| -name: string    |<>---->| -typeOfWash: string |
| -address: string |       | -fee: float        |
| -phone: string   |       | +computeFee(): float|
| -carCount: int   |       | -controlPanel     |
+------------------+       | -isBusy: boolean   |
                            +------------------+

本站部分文章来源于网络,版权归原作者所有,如有侵权请联系站长删除。
转载请注明出处:https://golang.0voice.com/?id=5235

分享:
扫描分享到社交APP
上一篇
下一篇
发表列表
游客 游客
此处应有掌声~
评论列表

还没有评论,快来说点什么吧~

联系我们

在线咨询: 点击这里给我发消息

微信号:3007537140

上班时间: 10:30-22:30

关注我们
x

注册

已经有帐号?