程序的UML图

UML Diagram for program

我必须完成一个实现停车场系统的程序。 我从 UML 图开始,因为我认为在那之后程序更容易完成,但我有点笨拙。 场景是:

  1. 设计并实现 class 车辆(抽象)和子classes 汽车、货车、摩托车。 classes 应包括适当的方法并保存有关车辆 ID 牌照、车辆品牌和停车场入口 time/date 的信息。

特别是:

• 汽车 class 还应包括适当的方法和持有信息 关于车门的数量和颜色。
• Van class 还应包括有关货物的方法和信息 面包车的体积。
class 摩托车也应该有关于尺寸的方法和信息 摩托车的引擎。

你应该实现一个 class DateTime 来表示入口的 time/date 在停车场的车辆。不要使用任何预定义的库。

  1. 设计并实现一个名为 MyCarParkManager 的 class,它扩展了 接口 CarParkManager。 MyCarParkManager 维护列表 当前停放的车辆。
    class 应该在控制台中显示一个菜单,用户可以从中 select 以下管理操作:

• 如果有免费车位(考虑到最大车位数量为 20)并且 return 剩余的免费车位数量,则在停车场添加新车辆。考虑一辆货车占据了 2 个地段。显示一条消息,其中包含免费手数或通知没有可用手数。

• 在车辆离开停车场时从列表中删除select带有ID 牌照的车辆和return 车辆实例。显示离开停车场的车辆类型(如果是汽车、货车或摩托车)。

• 打印当前停放的车辆列表。为每辆车打印 ID 板、进入时间和车辆类型(如果是汽车、货车或摩托车)。该列表应按时间顺序排列,将最后进入停车场的车辆显示为列表中的第一个。

这就是我目前所知道的。 My Solution

既然class Vehicle 是抽象的,不能实例化,我应该用什么来创建不同的vehicle 对象,可以是数组吗?以及输出应该如何改变,我的意思是取决于输入将是什么:如果是汽车,还要求颜色,如果是货车,是否有载货量?

非常感谢您花时间阅读它并查看此 UML 是否正确。

建议您:

  • class: "VehicleCardInfo" 用于存储汽车信息和状态
  • class:用于验证 "VehicleCardInfo"
  • 中所有数据的 RulesForCarPark
  • 词汇表:车型 e.t.c。

CarParkManager 作为 Actor 使用 UseCase "Managing Cars" 对 "VehicleCardInfo" 个对象进行 CRUD 操作。

也许我们需要一些规则来让人们登录和使用这个应用程序。

上面的UML图可能很简单(我们不使用关联,使用依赖关系)。

分析语句

An important skill that you will start to develop in this module is analyzing a problem statement in order to identify the details needed to develop a solution.In this assignment the first task you should perform is a careful analysis of the problem statement in order to make sure you have all the information to elaborate a solution. Do not make assumption about what is needed! If you are not sure, about the information provided, ask questions.

设计解决方案:

The design of your system should be consistent with the Object Oriented principles and easy to understand by an independent programmer.

来源:5COSC001W 面向对象编程 - 作业 1