欢迎进入xx汽车租赁公司
请输入用户名
请输入密码
(用户名默认是名字缩写,密码是123,将登陆模块封装到方法中去调用方法)
请输入您的操作
1)查看现在车库中的所有车辆信息
2)租赁汽车
3)往车库中添加汽车
4)修改汽车租赁价格信息

用switch去判断操作
类分析

![在这里插入图片描述](https://img-blog.csdnimg.cn/2019120215193140.png?x-oss-process=im

package com.youjiuye.bms;public class CRMS {public static void main(String[] args) {Wellcome();}public static void Wellcome(){System.out.println("***********************************");System.out.println("\t欢迎来到何老板图书馆                        ");System.out.println("***********************************");// 获取用户信息Tool.inputInfo();}
}
package com.youjiuye.bms;
/** 汽车租赁系统的功能模块类* 1、管理员添加车库中的车辆信息* 2、用户租赁车辆* 3、用户查看车库中的车辆* 4、用户查看自己租赁的车辆* 5、管理员修改车辆的价格* 6、用户结算租金*/
public class CRMSService {//    1、管理员添加车库中的车辆信息public boolean addVehicel(MotoVehicel mo){boolean bo = false;MotoVehicel[] ms = MotoVehicel.getMs();if(ms.length > 0){for (int i = 0; i < ms.length; i++) {if(ms[i] == null){ms[i] = mo;bo = true;System.out.println("添加成功!");break;}}}return bo;}//   2、用户租赁车辆public void rent(Users u,MotoVehicel mo){MotoVehicel[] ms = u.getUms();for (int i = 0; i < ms.length; i++) {if(ms[i]  == null){ms[i] = mo;break;}}}//     4、用户查看自己租赁的车辆public boolean browse(Users u){boolean bo  = false;MotoVehicel[] mo = u.getUms();if(mo.length > 0){for (int i = 0; i < mo.length; i++) {if(mo[i] != null){System.out.println(mo[i].toString());bo = true;}}}return bo;}//     5、管理员修改车辆的价格public boolean update(String no,double price){boolean bo = false;if(MotoVehicel.arrayExit()){MotoVehicel[] ms = MotoVehicel.getMs();for (int i = 0; i < ms.length; i++) {if(ms[i] != null && ms[i].getNo().equals(no)){ms[i].setRentPrice(price);System.out.println("修改成功!");System.out.println(ms[i]);bo = true;}}}else{System.out.println("当前车库中还没有车辆");}return bo;}//   6、用户结算租金public double settleAccount(Users u,int days){double price = 0;MotoVehicel[] mo = u.getUms();if(mo.length > 0){  for (int i = 0; i < mo.length; i++) {if(mo[i] != null){price += mo[i].getRentPrice() * days;}}}return price;}// 删除车库中的车辆public void delete(MotoVehicel moo){MotoVehicel[] mo = MotoVehicel.getMs();if(mo.length > 0){for (int i = 0; i < mo.length; i++) {if(mo[i] != null && mo[i].equals(moo)){mo[i] = null;}}}}// 根据车牌号来判断车库中是否含有该车辆public boolean judgeExitMotoVehicel(String no){boolean bo = false;MotoVehicel[] ms = MotoVehicel.getMs();if(ms.length >0){for (int i = 0; i < ms.length; i++) {if(ms[i].getNo().equals(no)){bo = true;break;}}}return bo;}
}
package com.youjiuye.bms;
/** 汽车租赁系统的功能模块类* 1、管理员添加车库中的车辆信息* 2、用户租赁车辆* 3、用户查看车库中的车辆* 4、用户查看自己租赁的车辆* 5、管理员修改车辆的价格* 6、用户结算租金*/
public class CRMSService {//    1、管理员添加车库中的车辆信息public boolean addVehicel(MotoVehicel mo){boolean bo = false;MotoVehicel[] ms = MotoVehicel.getMs();if(ms.length > 0){for (int i = 0; i < ms.length; i++) {if(ms[i] == null){ms[i] = mo;bo = true;System.out.println("添加成功!");break;}}}return bo;}//   2、用户租赁车辆public void rent(Users u,MotoVehicel mo){MotoVehicel[] ms = u.getUms();for (int i = 0; i < ms.length; i++) {if(ms[i]  == null){ms[i] = mo;break;}}}//     4、用户查看自己租赁的车辆public boolean browse(Users u){boolean bo  = false;MotoVehicel[] mo = u.getUms();if(mo.length > 0){for (int i = 0; i < mo.length; i++) {if(mo[i] != null){System.out.println(mo[i].toString());bo = true;}}}return bo;}//     5、管理员修改车辆的价格public boolean update(String no,double price){boolean bo = false;if(MotoVehicel.arrayExit()){MotoVehicel[] ms = MotoVehicel.getMs();for (int i = 0; i < ms.length; i++) {if(ms[i] != null && ms[i].getNo().equals(no)){ms[i].setRentPrice(price);System.out.println("修改成功!");System.out.println(ms[i]);bo = true;}}}else{System.out.println("当前车库中还没有车辆");}return bo;}//   6、用户结算租金public double settleAccount(Users u,int days){double price = 0;MotoVehicel[] mo = u.getUms();if(mo.length > 0){  for (int i = 0; i < mo.length; i++) {if(mo[i] != null){price += mo[i].getRentPrice() * days;}}}return price;}// 删除车库中的车辆public void delete(MotoVehicel moo){MotoVehicel[] mo = MotoVehicel.getMs();if(mo.length > 0){for (int i = 0; i < mo.length; i++) {if(mo[i] != null && mo[i].equals(moo)){mo[i] = null;}}}}// 根据车牌号来判断车库中是否含有该车辆public boolean judgeExitMotoVehicel(String no){boolean bo = false;MotoVehicel[] ms = MotoVehicel.getMs();if(ms.length >0){for (int i = 0; i < ms.length; i++) {if(ms[i].getNo().equals(no)){bo = true;break;}}}return bo;}
}
package com.youjiuye.bms;public class Users {private String identity;private String password;// 存放租赁的车辆信息private MotoVehicel[] ums = new MotoVehicel[10];  public MotoVehicel[] getUms() {return ums;}public void setUms(MotoVehicel[] ums) {this.ums = ums;}public Users(){}public Users(String identity, String password) {super();this.identity = identity;this.password = password;}public String getIdentity() {return identity;}public void setIdentity(String identity) {this.identity = identity;}public String getPassword() {return password;}public void setPassword(String password) {this.password = password;}@Overridepublic String toString() {return "Users [identity=" + identity + ", password=" + password + "]";}
}
package com.youjiuye.bms;
/** 所有车的父类* */public abstract class MotoVehicel {private String no;private String brand;private String Color;private int mileage;private double rentPrice;private static MotoVehicel[] ms= new MotoVehicel[10];public MotoVehicel(){}public MotoVehicel(String no, String brand, String color, int mileage, double rentPrice) {super();this.no = no;this.brand = brand;Color = color;this.mileage = mileage;this.rentPrice = rentPrice;}public String getNo() {return no;}public void setNo(String no) {this.no = no;}public String getBrand() {return brand;}public void setBrand(String brand) {this.brand = brand;}public String getColor() {return Color;}public void setColor(String color) {Color = color;}public int getMileage() {return mileage;}public void setMileage(int mileage) {this.mileage = mileage;}public double getRentPrice() {return rentPrice;}public void setRentPrice(double rentPrice) {this.rentPrice = rentPrice;}// 获取车库数组public static MotoVehicel[] getMs() {return ms;}// 租赁功能public abstract double rent(int days);// 初始化车库数组public static final void init(){Car c1 = new Car("001", "bwm","蓝色",10000, 500,"x5");ms[0] = c1;Bus b1 = new Bus("8567", "景龙", "绿色",2000, 800,16);ms[1] = b1;}// 判断当前车库是否有车存在public static boolean arrayExit(){boolean bo = false;if(ms.length > 0){for (int i = 0; i < ms.length; i++) {if(ms[i] != null){bo = true;}}}else{bo = false;}return bo;}// 显示车库中现有的车辆public static void show(){System.out.println("当前车库的车:");if(arrayExit()){for (int i = 0; i < ms.length; i++) {if(ms[i] != null){System.out.println(ms[i]);}}}else{System.out.println("当前车库中没有车辆");}}}

```java
package com.youjiuye.bms;
/** 公交车*/public class Bus extends MotoVehicel{private int seatCount;public Bus(){}public Bus(String no, String brand, String color, int mileage, double rentPrice,int seatCount) {super(no, brand, color, mileage, rentPrice);this.seatCount = seatCount;  }public int getSeatCount() {return seatCount;}public void setSeatCount(int seatCount) {this.seatCount = seatCount;}@Overridepublic String toString() {return "Bus [ 车牌号:"+ getNo()+"\t品牌:"+getBrand()+"\t座位数:"+getSeatCount()+"\t颜色:"+ getColor()+"\t里程:"+getMileage()+"\t日租价:"+getRentPrice()+ "]";}@Overridepublic double rent(int days) {return days * getRentPrice();}}
package com.youjiuye.bms;
/** 小轿车*/public class Car extends MotoVehicel{private String type;public Car(){}public Car(String no, String brand, String color, int mileage, double rentPrice,String type) {super(no, brand, color, mileage, rentPrice);this.type = type;    }public String getType() {return type;}public void setType(String type) {this.type = type;}@Overridepublic String toString() {return "Car [ 车牌号: "+ getNo()+"\t品牌:"+getBrand()+"\t型号:"+getType()+"\t颜色:"+ getColor()+"\t里程:"+getMileage()+"\t日租价:"+getRentPrice()+ "]";}@Overridepublic double rent(int days) {return days * getRentPrice();}
}

java实现汽车租赁系统相关推荐

  1. java毕业设计汽车租赁系统演示录像源码+lw文档+mybatis+系统+mysql数据库+调试

    java毕业设计汽车租赁系统演示录像源码+lw文档+mybatis+系统+mysql数据库+调试 java毕业设计汽车租赁系统演示录像源码+lw文档+mybatis+系统+mysql数据库+调试 本源 ...

  2. java毕业设计汽车租赁系统mybatis+源码+调试部署+系统+数据库+lw

    java毕业设计汽车租赁系统mybatis+源码+调试部署+系统+数据库+lw java毕业设计汽车租赁系统mybatis+源码+调试部署+系统+数据库+lw 本源码技术栈: 项目架构:B/S架构 开 ...

  3. Java窗体汽车租赁系统Java共享汽车租赁(租赁系统)

    Java窗体汽车租赁系统Java共享汽车租赁(租赁系统)

  4. Java项目:汽车租赁系统(java+SSM+JSP+LayUI+echarts+mysql)

    源码获取:博客首页 "资源" 里下载! ssm汽车租赁系统 carRental 系统概要 汽车租赁系统总共分为两个大的模块,分别是系统模块和业务模块.其中系统模块和业务模块底下又有 ...

  5. java springboot汽车租赁系统小程序-uniapp

    .系统主要包括系统首页.个人中心.用户管理.驾驶证管理.车辆品牌管理.车辆信息管理.预约租赁管理.汽车租赁管理.还车信息管理.费用结算管理.系统管理等功能模块. 任何系统都要遵循系统设计的基本流程,本 ...

  6. Java编写汽车租赁系统

    题目要求: 1.汽车租赁信息表如下: 2.类和属性: 3.运行效果: 效果实现: 代码实现: 1.车类: package homework.exam;public abstract class Veh ...

  7. 基于JAVA+SpringMVC+Mybatis+MYSQL的汽车租赁系统

    项目功能: 系统概要 汽车租赁系统总共分为两个大的模块,分别是系统模块和业务模块.其中系统模块和业务模块底下又有其子模块. 系统分为四类用户角色:超级管理员.业务管理员.系统管理员.数据统计管理员.角 ...

  8. JAVA汽车租赁系统(JAVA毕业设计)

    前言 课设毕设源码收集已上传到github,地址:https://github.com/52JDK/Source-Collection 如果对大家有用的话欢迎点个star,本文源码请直接到文章末尾 简 ...

  9. 基于JAVA汽车租赁系统计算机毕业设计源码+系统+lw文档+部署

    基于JAVA汽车租赁系统计算机毕业设计源码+系统+lw文档+部署 基于JAVA汽车租赁系统计算机毕业设计源码+系统+lw文档+部署 本源码技术栈: 项目架构:B/S架构 开发语言:Java语言 开发软 ...

  10. 基于JAVA汽车租赁系统计算机毕业设计源码+数据库+lw文档+系统+部署

    基于JAVA汽车租赁系统计算机毕业设计源码+数据库+lw文档+系统+部署 基于JAVA汽车租赁系统计算机毕业设计源码+数据库+lw文档+系统+部署 本源码技术栈: 项目架构:B/S架构 开发语言:Ja ...

最新文章

  1. MVC验证10-到底用哪种方式实现客户端服务端双重异步验证
  2. 关于File.separator 文件路径:wind与linux下路径问题 .
  3. Java的自动装箱与拆箱
  4. 2016.8.1今天是建军节
  5. 如何使用SAP UI5 Web Component for React的padding功能
  6. git 子模块_Git子模块的问题
  7. 【读书笔记《Android游戏编程之从零开始》】11.游戏开发基础(SurfaceView 游戏框架、View 和 SurfaceView 的区别)...
  8. 怎么将后缀为.opt,.frm,.myd,.myi文件还原或者是导入mySQL中
  9. OmniPlan Pro 4 for Mac(项目流程管理)
  10. BLE蓝牙模块NRF518/NRF281/NRF528/NRF284芯片方案对比
  11. 山东理工大学计算机基础考试试题,山东理工大学计算机基础试题08
  12. Python的数学计算库scipy介绍
  13. 指数基金投资从入门到精通——阅读笔记
  14. [转帖]生成QQ/MSN/旺旺/SKYPE等在线状态图标(官方提供)
  15. 揭秘让您正确识别和处理恶意邮件的五种方法
  16. 【前端面试题】数据类型-js
  17. Bouncy Castle Java 平台轻量级密码术包
  18. 数据结构-连续线段-C语言-[输入n条线段各个端点坐标,求包含最多线段的连续线段]
  19. pdf2html java_pdf2HtmlEX的使用
  20. 什么是意志力?如何提高意志力?

热门文章

  1. midi是计算机合成音乐文件,多媒体音频详解.ppt
  2. 学计算机辅助设计的,计算机辅助设计学习方法
  3. 冰雪传奇刷怪计时器_专业冰雪传奇辅助计时器
  4. 手把手教你写一个web聊天室之bookstap框架
  5. 【历史上的今天】2 月 22 日:Red Hat Enterprise Linux 问世;BASIC 语言作者出生;计算机协会创始人诞生
  6. Tar的详细用法(转自Linux伊甸园)
  7. 硬盘常见接口类型详解
  8. 好多网友都不知道怎么阅读Linux内核源码,这篇让你快速理解
  9. Windows安装镜像下载
  10. 常用值得收藏的网站/软件 持续更新中