汽车租赁系统

汽车租赁系统
在这里插入图片描述
汽车租赁系统
设计步骤
1.设计需求
2.面向对象的设计思想
(1)名词【类,类的属性】
(2)动词【类的方法】
优化设计
设计组成
1.汽车类(父类)
(1)品牌,
(2)日租金
(3)车牌号
(4)构造方法
(5)计算租金
2.轿车类(子类)
(1)品牌,
(2)日租金
(3)车牌号
(4)型号【特有】
(5)构造方法
(5)重写轿车租金计算方法
3.客车类(子类)
(1)品牌,
(2)日租金
(3)车牌号
(4)座位数【特有】
(5)构造方法
(5)重写客车租金计算方法
4.汽车服务类
(1)初始化汽车信息
(2)根据给出的信息查找车辆
5.租赁管理类
(1)购置汽车
(2)客户租车给定的条件
(3)收集客人信息找出车
(4)租车&计算租金

例:
1、父类--------------------------------------------------------------------------------------------------------------------------------------------------

package com.cn.vehicle;
public abstract class Motoqiche {
     
     private String pingPai;      //品牌
     private String motoID;       //车牌
     private int perRent;         //日租金
     
     
     //构造方法
     
     public Motoqiche() {}
     
     public Motoqiche(String pingPai,String motoID,int perRent) {
          this.pingPai=pingPai;
          this.motoID=motoID;
          this.perRent=perRent;
          
     }
     public String getPingPai() {
          return pingPai;
     }
     public void setPingPai(String pingPai) {
          this.pingPai = pingPai;
     }
     public String getMotoID() {
          return motoID;
     }
     public void setMotoID(String motoID) {
          this.motoID = motoID;
     }
     public int getPerRent() {
          return perRent;
     }
     public void setPerRent(int perRent) {
          this.perRent = perRent;
     }
     
     //计算租金的抽象方法
     public abstract double renMoney(int day);
     
}

2.子类轿车-----------------------------------------------------------------------------------------

package com.cn.vehicle;
//轿车类
public class Cat extends Motoqiche {
     
     private String type;         //轿车特有的型号
     
     public String getType() {
          return type;
     }
     public void setType(String type) {
          this.type = type;
     }
     //构造方法
     public Cat() {}
     public Cat(String pingPai,String motoID,int perRent,String type) {
          super(pingPai,motoID,perRent);             //继承父类的品牌,车牌号,日租金
          this.type = type;
     }
     @Override
     public double renMoney(int day) {
          double dayRent=this.getPerRent()*day;
          
          if(day>7&&day<=30) {
              dayRent*=0.9;
          }else if(day>30&&day<=150) {
              dayRent*=0.8;
          }else {
              dayRent*=0.7;
          }
          return dayRent;
     }
}

3.子类客车---------------------------------------------------------------------------------------------------------------

package com.cn.vehicle;
//客车类
public class Bus extends Motoqiche {
     
     private int zuiWei;     //客车特有座位数
     
     public int getZuiWei() {
          return zuiWei;
     }
     public void setZuiWei(int zuiWei) {
          this.zuiWei = zuiWei;
     }
     
     //构造方法
     public Bus() {}
     public Bus(String pingPai,String motoID,int perRent,int zuiWei) {
          super(pingPai,motoID,perRent);
          this.zuiWei = zuiWei;
     }
     @Override
     public double renMoney(int day) {
          double dayRent=this.getPerRent()*day;
          if(day>=3&&day<7) {
              dayRent*=0.9;
          }else if(day>=7&&day<30) {
              dayRent*=0.8;
          }else if(day>=30&&day<150){
              dayRent*=0.7;
          }else {
              dayRent*=0.6;
          }
          return dayRent;
     }
}

4.服务类--------------------------------------------------------------------------------------------------------------

package com.cn.vehicle.text;

import com.cn.vehicle.Bus;
import com.cn.vehicle.Cat;
import com.cn.vehicle.Motoqiche;

//租车服务类
public class Motofuwu {
    //将初始化信息存放数组中
    public Motoqiche[] motos=new Motoqiche[8];
    
    //初始化车辆信息
    public void init() {
        motos[0]=new Cat("宝马","晋A12345",800,"X6");    
        motos[1]=new Cat("宝马","晋A33345",600,"550i");    
        motos[2]=new Cat("别克","晋A12445",300,"林荫大道");    
        motos[3]=new Cat("别克","晋A09875",600,"GL8");
        motos[4]=new Bus("金杯","晋A13445",800,16);
        motos[5]=new Bus("金杯","晋A12665",1500,32);
        motos[6]=new Bus("金龙","晋A12555",800,16);
        motos[7]=new Bus("金龙","晋A12390",1500,32);
        
    }
    //根据给出的信息寻找车辆
    public Motoqiche xunzhao(String pingPai,String type,int zuoWei) {
        Motoqiche moto=null;
        for(Motoqiche mymoto:motos) {
        if(mymoto instanceof Cat) {
            Cat cat=(Cat)mymoto;
            //寻找的为轿车
            if(cat.getPingPai().equals(pingPai)&&cat.getType().equals(type)) {
                moto=cat;
                break;    
            }
        
        }else if(mymoto instanceof Bus) {
             Bus bus=(Bus)mymoto;
            //寻找客车
            if(bus.getPingPai().equals(pingPai)&&bus.getZuiWei()==(zuoWei)) {
                moto=bus;
                break;
            }
        
            }
        }
        return moto;
    }

}

5.测试类--------------------------------------------------------------------------------------------------------

package com.cn.vehicle.text;

import java.util.Scanner;

import com.cn.vehicle.Motoqiche;

public class MotoRentText {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        Motofuwu rentFuwu=new Motofuwu();
        //购置汽车
        rentFuwu.init();
        //定义用户需要输入的信息
        String pingPai=" ";
        String type=" ";
        int zuoWei=0;
        
        //收集客人信息
        System.out.println("------------------------欢迎光临--------------------------");
        System.out.println("请输入您要租赁的汽车类型 1.轿车 2.客车");
        int choos1=input.nextInt();
        if(choos1==1) {
            //租赁轿车
            System.out.println("请输入您要租赁的轿车品牌 1.宝马 2.别克");
            int no=input.nextInt();
            if(no==1) {
                pingPai="宝马";
                System.out.println("请输入您要租赁的宝马车型 1.X6 2.550i");
                int n=input.nextInt();
                type=(n==1)?"X6":"550i";
                
            }else {
                pingPai="别克";
                System.out.println("请输入您要租赁的别克车型 1.林荫大道 2.GL8");
                int n=input.nextInt();
                type=(n==1)?"林荫大道":"GL8";
                
            }
        }else if(choos1==2) {
            //租赁客车
            System.out.println("请输入您要租赁的轿车品牌 1.金杯 2.金龙");
            int no=input.nextInt();
            if(no==1) {
                pingPai="金杯";
                System.out.println("请输入您要租赁的金杯座位数 1.16 2.32");
                int n=input.nextInt();
                zuoWei=(n==1)?16:32;
                
            }else {
                pingPai="金龙";
                System.out.println("请输入您要租赁的金龙座位数 1.16 2.32");
                int n=input.nextInt();
                zuoWei=(n==1)?16:32;
                
            }
        }
        //租车&计算金额
        Motoqiche moto=rentFuwu.xunzhao(pingPai, type, zuoWei);
        
        System.out.println("租车成功,请按如下车牌提车"+moto.getMotoID());
        
        System.out.println("请输入您租赁的天数");
        int day=input.nextInt();
        double summoney=moto.renMoney(day);
        System.out.println("需要支付"+summoney+"元");
        
    }

}
  • 3
    点赞
  • 46
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
【资源说明】 基于SpringBoot+Vue的汽车租赁系统源码+项目使用说明.zip 一、 项目介绍 基于SpringBoot Vue的汽车租赁系统 角色:管理员、业务员、用户 管理员: 管理员登录系统后,可以对首页,个人中心,用户管理,业务员管理,汽车类型管理,租赁汽车管理,汽车租赁管理,汽车归还管理,租赁订单管理,检查信息管理,系统管理 业务员:登录进入致远汽车租赁系统可以对首页,个人中心,汽车租赁管理,汽车归还管理,租赁订单管理,检查信息管理等 用户:用户登录进入致远汽车租赁系统可以对首页,个人中心,汽车租赁管理,汽车归还管理,租赁订单管理,检查信息管理,我的收藏管理等 ## 二、 视频演示 <p style="text-align: center;"><strong><span class="ne-text">建议点击这个</span><a style="color: #ff0000;" href="https://www.bilibili.com/video/BV1vx4y1P7nQ/?spm_id_from=333.999.0.0&vd_source=b5789de9f485ad6d0cfaeca1ad4b230c">“链接”</a>查看高清视频</strong></p> ## 三、项目技术 后端: SpringBoot+Mybaits 前端:Vue +ElementUI +Layui +HTML+CSS+JS ## 四、 运行环境 开发语言:Java 项目架构:B/S架构 开发工具:IDEA,Eclipse,Myeclipse都可以。推荐IDEA JDK版本:1.8 数据库: MySQL8.0版本以上 项目管理:Maven 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载使用,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可直接用于毕设、课设、作业等。 欢迎下载,沟通交流,互相学习,共同进步!
一、项目简介本课程演示的是一套基于SSM实现的汽车租赁系统,主要针对计算机相关专业的正在做毕设的学生与需要项目实战练习的Java学习者。课程包含: 1. 项目源码、项目文档、数据库脚本、软件工具等所有资料2. 带你从零开始部署运行本套系统3. 该项目附带的源码资料可作为毕设使用4. 提供技术答疑和远程协助指导二、技术实现 后台框架:Spring、SpringMVC、MyBatisUI界面:jQuery 、JSP数据库:MySQL 三、系统功能系统分为前台用户租车和后台系统管理:    1.前台用户租车        用户注册、用户登录、用户中心、浏览车辆、车辆搜索        查看车辆明细、租赁车辆、我的订单    2.后台系统管理        用户管理:用户列表、添加用户、修改用户、删除用户、查询用户        新闻管理:新闻列表、添加新闻、修改新闻、删除新闻、查询新闻        车辆品牌管理:车辆品牌列表、添加车辆品牌、修改车辆品牌、删除车辆品牌        车辆管理:车辆列表、添加车辆、修改车辆、删除车辆、查询车辆        订单管理:订单列表、确认订单、删除订单        报表管理:统计信息查询和展示 四、项目截图1)前台用户界面 2)后台系统管理    更多Java毕设项目请关注【毕设系列课程】https://edu.csdn.net/lecturer/2104   点击 我的百科 ,通过百度百科更多了解我 ^_^ 

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Abner G

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值