package CarRentalSystem.admin;
import CarRentalSystem.RentMgrSys.RentMgrSys;
import CarRentalSystem.menuMsg.menuMsg;
import CarRentalSystem.JDBCUtils.jdbcUtilsByAdmin;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;
public class admin {
Scanner in = new Scanner(System.in);
int newCarKind;
private String newBrand = "";
private String newType = "";
private String newVehicle = "";
private int perRent = 0;
private int newBusSeats = 0;
private int newSeats = 0;
private int newLoad = 0;
private int deleteCarType = 0;
private int theDeleteCar;
private int id = 12;
private int newCarNums=0;
private int feature=0;
private double income = 0;//初始营业额为0,每次管理登录时从数据库中读取营业额更新,这里的income用作查看与像数据库传值
public int getFeature() {
return feature;
}
public void setFeature(int feature) {
this.feature = feature;
}
//setter 和 getter
public int getPerRent() {
return perRent;
}
public void setPerRent(int perRent) {
this.perRent = perRent;
}
public int getNewBusSeats() {
return newBusSeats;
}
public void setNewBusSeats(int newBusSeats) {
this.newBusSeats = newBusSeats;
}
public int getNewLoad() {
return newLoad;
}
public void setNewLoad(int newLoad) {
this.newLoad = newLoad;
}
public int getDeleteCarType() {
return deleteCarType;
}
public void setDeleteCarType(int deleteCarType) {
this.deleteCarType = deleteCarType;
}
public int getTheDeleteCar() {
return theDeleteCar;
}
public void setTheDeleteCar(int theDeleteCar) {
this.theDeleteCar = theDeleteCar;
}
public void deleteCarMethod(){}
public String getNewBrand() {
return newBrand;
}
public void setNewBrand(String newBrand) {
this.newBrand = newBrand;
}
public String getNewType() {
return newType;
}
public void setNewType(String newType) {
this.newType = newType;
}
public String getNewVehicle() {
return newVehicle;
}
public void setNewVehicle(String newVehicle) {
this.newVehicle = newVehicle;
}
public int getNewSeats() {
return newSeats;
}
public void setNewSeats(int seats) {
this.newSeats = newSeats;
}
public double getIncome(){
return income;
}
public void setIncome(double rent){
this.income += rent;
}
public int getNewCarNums() {
return newCarNums;
}
public void setNewCarNums(int newCarNums) {
this.newCarNums = newCarNums;
}
public static void relenishment(int id, int addNums){
try {
RentMgrSys.rs = RentMgrSys.stmt.executeQuery(jdbcUtilsByAdmin.sqlSearchCarSpecifyInfo("nums", id));
RentMgrSys.rs.next();
int numsBefore = RentMgrSys.rs.getInt("nums");
RentMgrSys.stmt.executeUpdate("update cardata set nums="+numsBefore+addNums+" where id="+id);
} catch (SQLException e) {
e.printStackTrace();
}
}
public int getId() {
return id;
}
public void setId(int num) {
this.id = num;
}
public static void showCarsInSystemNow(){
try {
RentMgrSys.rs = RentMgrSys.stmt.executeQuery("select * from cardata");
RentMgrSys.rs.absolute(1);
do {
System.out.println("编号: "+RentMgrSys.rs.getInt("id")+"\t\t车类: "+RentMgrSys.rs.getString("vehicle")+"\t\t品牌: "+RentMgrSys.rs.getString("brand")+"\t\t\t车牌号: "+RentMgrSys.rs.getString("type")+"\t\t\t日租金: "+RentMgrSys.rs.getInt("preRent")+"\t\t\t当前系统存量: "+RentMgrSys.rs.getInt("nums"));
}while(RentMgrSys.rs.next());
} catch (SQLException e) {
e.printStackTrace();
}
}
public static void showSpecificKindCarsInfo(ResultSet rs){
try {
rs.last();
int row = rs.getRow();
if(row == 0){
System.out.println("系统中没有此类车");
return;
}
rs.absolute(1);
String strVehicle="", strBrand="", strType="", strId="", strPreRent="", strNums="";
do{
strId = "编号: "+rs.getInt("id");
strVehicle = "分类: "+rs.getString("vehicle");
strBrand = "品牌: "+rs.getString("brand");
strType = "车牌号: "+rs.getString("type");
strPreRent = "日租金: "+rs.getInt("preRent");
strNums = "存量: "+rs.getInt("nums");
strId = String.format("%-25s", strId);
strVehicle = String.format("%-25s", strVehicle);
strBrand = String.format("%-25s", strBrand);
strType = String.format("%-25s", strType);
strPreRent = String.format("%-25s", strPreRent);
strNums = String.format("%-25s", strNums);
System.out.println(strId+strVehicle+strBrand+strType+strPreRent+strNums);
}while(rs.next());
} catch (SQLException e) {
e.printStackTrace();
}
}
public static void deleteWhichCar(String carKind){
try {
RentMgrSys.rs = RentMgrSys.stmt.executeQuery(jdbcUtilsByAdmin.sqlReadSpecificKindCar(carKind));
menuMsg.deleteThatCar();
int id = RentMgrSys.in.nextInt();
int count = RentMgrSys.stmt.executeUpdate(jdbcUtilsByAdmin.sqlDeleteCar(id));
if(id == 1){
System.out.println("车辆删除成功");
}
} catch (SQLException e) {
e.printStackTrace();
}
}
public void adminSystem(){
int choice;
menuMsg.helloAdmin();
while(true){
menuMsg.adminMenu();
choice = RentMgrSys.in.nextInt();
switch (choice){
case -1:
RentMgrSys.logOut=true;
break;
case 0:
RentMgrSys.isOver=true;
break;
case 1:
menuMsg.ShowNowInfo();
admin.showCarsInSystemNow();
//meauMsg.adminMenu();
break;
case 2:
try {
RentMgrSys.rs = RentMgrSys.stmt.executeQuery(jdbcUtilsByAdmin.sqlReadMoneyNow(0));
RentMgrSys.rs.next();
System.out.println("截止目前,您的收人为:"+RentMgrSys.rs.getFloat("money")+"元");
} catch (SQLException e) {
e.printStackTrace();
}
//meauMsg.adminMenu();
break;
case 3:
menuMsg.readyToAddVehicle();
newCarKind = in.nextInt();
String c="";
//c = RentMgrSys.in.nextLine();
if(newCarKind == 1){
//vehicle-车的名牌(大类,比如轿车、客车)、brand(车的品牌, 比如玛莎拉蒂)、type(车牌号)、preRent(日租金)
//meauMsg.setNewVihicle();
setNewVehicle("客车");
menuMsg.setNewCarBrand();
setNewBrand(in.next());
menuMsg.setNewCarType();
setNewType(in.next());
menuMsg.setNewCarRentdaily(
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
暮商租车系统V4.0.rar (68个子文件)
暮商租车系统V4.0
功能结构图.png 83KB
src
lib
mysql-connector-java-8.0.16.jar 2.19MB
rentCar_V4.0.iml 429B
CarRentalSystem
CarInfo
Trunk.java 1KB
Bus.java 984B
Vehicle.java 2KB
Car.java 992B
admin
admin.java 19KB
RentMgrSys
RentMgrSys.java 5KB
menuMsg
menuMsg.java 7KB
costomer
aboutCostomerMenu.java 312B
VIPAboutCostomer.java 8KB
ordinaryAboutCostomer.java 10KB
User.java 14KB
loginAndRegister
Register.java 3KB
Login.java 4KB
JDBCUtils
DBLinkOver.java 798B
jdbcUtilsByAdmin.java 6KB
jdbcUtilsByCostomer.java 2KB
.idea
libraries
mysql_connector_java_8_0_16.xml 252B
vcs.xml 194B
workspace.xml 2KB
misc.xml 177B
modules.xml 271B
.gitignore 190B
SQL文件
usersinfo.sql 2KB
userowncar.sql 2KB
cardata.sql 2KB
CarRentalSystemV4_0_UML.puml 7KB
out
production
untitled1
lib
mysql-connector-java-8.0.16.jar 2.19MB
CarRentSystem4.0
lib
mysql-connector-java-8.0.16.jar 2.19MB
CarRentalSystem
CarInfo
Trunk.class 1KB
Vehicle.class 2KB
Car.class 1KB
Bus.class 1KB
admin
admin.class 11KB
RentMgrSys
RentMgrSys.class 5KB
menuMsg
menuMsg.class 7KB
costomer
User.class 10KB
VIPAboutCostomer.class 7KB
aboutCostomerMenu.class 374B
ordinaryAboutCostomer.class 8KB
loginAndRegister
Register.class 3KB
Login$LoginJustifyResult.class 1KB
Login.class 3KB
JDBCUtils
DBLinkOver.class 931B
jdbcUtilsByAdmin.class 6KB
jdbcUtilsByCostomer.class 3KB
.idea
project-template.xml 91B
dataSources
5db7b944-3bc1-46ca-b263-c1b4f7a798f2
storage_v2
_src_
schema
information_schema.FNRwLQ.meta 76B
5db7b944-3bc1-46ca-b263-c1b4f7a798f2.xml 37KB
49f28fcc-e9a6-4188-ba0b-a44fb3f906bc.xml 157KB
dataSources.local.xml 2KB
description.html 97B
uiDesigner.xml 9KB
sqldialects.xml 284B
libraries
mysql_connector_java_8_0_16.xml 256B
workspace.xml 24KB
misc.xml 411B
dataSources.xml 1KB
inspectionProfiles
Project_Default.xml 1KB
modules.xml 279B
.gitignore 190B
encodings.xml 164B
CarRentalSystemV4_0_UML.png 278KB
汽车租赁管理系统 V4.0 说明书.md 23KB
CarRentSystem4.0.iml 793B
CarRentalSystemV4.0_UML.puml 7KB
共 68 条
- 1
资源评论
六时二一
- 粉丝: 394
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- pta题库答案c语言之排序4统计工龄.zip
- pta题库答案c语言之树结构7堆中的路径.zip
- pta题库答案c语言之树结构3TreeTraversalsAgain.zip
- pta题库答案c语言之树结构2ListLeaves.zip
- pta题库答案c语言之树结构1树的同构.zip
- 基于C++实现民航飞行与地图简易管理系统可执行程序+说明+详细注释.zip
- pta题库答案c语言之复杂度1最大子列和问题.zip
- 三维装箱问题(Three-Dimensional Bin Packing Problem,3D-BPP)是一个经典的组合优化问题
- 以下是一些关于Linux线程同步的基本概念和方法.txt
- 以下是一个简化的示例,它使用pygame库来模拟烟花动画的框架.txt
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功