一、项目功能
1、展示所有可租车辆
2、选择车型、租车辆、租车天数
3、展示租车清单,包括总金额、总载货量及车型、总载客量及车型
二、项目分析
1、数据模型:通过对现实世界的事与物的主要特征的分析、抽象,提取数据结构及相应的约束。其中,数据结构的组成是:操作(方法)、属性,如将现实的车写成代码。本项目的数据模型是????模型。
| 货车(载货量) | 客车(载客量) | 皮卡车(载货、载客量) |
|
轻型(5t)、重型(5-20t) |
小客车(4人)、大客车(>10人) |
载货、载客 |
2、业务模型:设计程序之前,应该明确程序执行的任务,确认业务需求的目的在于创建一个能同时满足零售商和消费者需要的解决方案。本项目中➡️消费者。
用户
选车 租车天数 统计金额 载货、载客量
3、显示和流程
显示:用户可以看到的信息提示界面
流程:显示信息的执行过程、步骤
二、项目实现
1、模型层:在答答租车系统中,我们的数据模型是汽车,所以我们首先创建汽车模型类。
(1)创建汽车模型类
1 package com.companyname.model; 2 3 /** 4 * 汽车模型类 5 * 6 * @author wangna 7 */ 8 public class Car { 9 private int carId;// 车序号 10 private String carName; 11 private double priceForAday;// 一天的租金 12 private int personAmount;// 容量 13 private int carAmount;// 容量 14 15 public int getCarId() { 16 return carId; 17 } 18 19 public void setCarId(int carId) { 20 this.carId = carId; 21 } 22 23 public String getCarName() { 24 return carName; 25 } 26 27 public void setCarName(String carName) { 28 this.carName = carName; 29 } 30 31 public double getPriceForAday() { 32 return priceForAday; 33 } 34 35 public void setPriceForAday(double priceForAday) { 36 this.priceForAday = priceForAday; 37 } 38 39 public int getPersonAmount() { 40 return personAmount; 41 } 42 43 public void setPersonAmount(int personAmount) { 44 this.personAmount = personAmount; 45 } 46 47 public int getCarAmount() { 48 return carAmount; 49 } 50 51 public void setCarAmount(int carAmount) { 52 this.carAmount = carAmount; 53 } 54 55 }