package one;
import java.util.Scanner;
public class jieZu {
public jieZu() {
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("汽车租界系统");
String[] cd = new String[6];
String[] name = new String[6];
String[] phone = new String[6];
String[] cat = new String[6];
int[] dates = new int[6];
name[0] = "77";
phone[0] = "17639877548";
cat[0] = "金杯";
dates[0] = 21;
name[1] = "gg";
phone[1] = "17745478498";
cat[1] = "宝马X6";
dates[1] = 18;
String[] cName = new String[6];
String[] cID = new String[6];
int[] cDL = new int[6];
int[] chd = new int[6];
boolean[] czt = new boolean[]{false, true, true, false, false, false};
cName[0] = "宝马X6";
cName[1] = "宝马550i";
cName[2] = "别克林荫大道";
cName[3] = "金杯";
cID[0] = "豫NY28588";
cID[1] = "豫CNY3284";
cID[2] = "豫NT37465";
cID[3] = "豫B696996";
cDL[0] = 800;
cDL[1] = 600;
cDL[2] = 300;
cDL[3] = 1500;
chd[0] = 9;
chd[1] = 8;
chd[2] = 7;
chd[3] = 6;
label189:
while(true) {
System.out.println("1、添加车型");
System.out.println("2、删除车型");
System.out.println("3、租借车子");
System.out.println("4、归还车子");
System.out.println("5、查看所有车子");
System.out.println("6、查看所有账单");
System.out.println("7、退出");
System.out.println("输入指令");
String a;
int i;
int bb;
int i;
switch(scanner.nextInt()) {
case 1:
for(i = 0; i < cName.length; ++i) {
if (cName[i] == null) {
System.out.println("请输入要添加的车型:");
cName[i] = scanner.next();
System.out.println("请输入车牌号:");
cID[i] = scanner.next();
do {
do {
System.out.println("大于3天打多少折扣?(1-9)");
chd[i] = scanner.nextInt();
} while(chd[i] > 10);
} while(chd[i] < 0);
System.out.println("请输入日租金");
cDL[i] = scanner.nextInt();
czt[i] = true;
break;
}
}
break;
case 2:
System.out.println("车型名称\t\t车牌号\t日租金\t\t折扣\t\t租赁状态\n");
for(i = 0; i < cName.length; ++i) {
if (cName[i] != null) {
if (czt[i]) {
a = "在库";
} else {
a = "借出";
}
System.out.println(cName[i] + "\t\t" + cID[i] + "\t\t" + cDL[i] + "\t\t大于3天0." + chd[i] + "折,反之不打折\t\t" + a);
}
}
System.out.println("请输入要删除的车型名称:");
String b = scanner.next();
for(bb = 0; bb < cName.length; ++bb) {
assert cName[bb] != null;
if (cName[bb].equals(b)) {
cName[bb] = cName[bb + 1];
cID[bb] = cID[bb + 1];
chd[bb] = chd[bb + 1];
cDL[bb] = cDL[bb + 1];
czt[bb] = czt[bb + 1];
break;
}
}
System.out.println("删除成功!");
break;
case 3:
System.out.println("车型名称\t\t日租金\t\t折扣\t\t租赁状态\n");
for(bb = 0; bb < cName.length; ++bb) {
if (cName[bb] != null) {
if (czt[bb]) {
a = "在库";
} else {
a = "借出";
}
System.out.println(bb + 1 + "\t" + cName[bb] + "\t\t" + cDL[bb] + "\t\t大于3天0." + chd[bb] + "折,反之不打折\t\t" + a);
}
}
System.out.println("请输入要借车子的编号:");
bb = scanner.nextInt();
if (cName[bb - 1] != null && czt[bb - 1]) {
int i = 0;
while(true) {
if (i >= name.length) {
continue label189;
}
if (name[i] == null) {
System.out.println("请输入您的姓名:");
name[i] = scanner.next();
System.out.println("请输入您的手机号:");
phone[i] = scanner.next();
do {
do {
System.out.println("请输入本日(租借)日期:");
dates[i] = scanner.nextInt();
} while(dates[i] > 31);
} while(dates[i] < 0);
cat[i] = cName[bb - 1];
czt[i] = false;
System.out.println("添加成功!");
System.out.println("租车人姓名\t 租车人电话 \t租车具体信息 \t\t租车开始时间");
System.out.println(name[i] + "\t" + phone[i] + "\t" + cat[i] + "\t" + dates[i] + "号");
continue label189;
}
++i;
}
}
System.out.println("麻烦看清楚再租");
break;
case 4:
System.out.println("请输入您的姓名:");
String cc = scanner.next();
boolean v = true;
for(i = 0; i < name.length; ++i) {
if (cc.equals(name[i])) {
System.out.println("租车人姓名\t 租车人电话 \t租车具体信息 \t\t租车开始时间");
System.out.println(name[i] + "\t" + phone[i] + "\t" + cat[i] + "\t" + dates[i] + "号");
System.out.println("请输入归还日期:");
int aap = scanner.nextInt();
int wwb = aap - dates[i];
int sum = cDL[i] * wwb;
if (chd[i] != 10 && (wwb >= 3 || wwb < 0)) {
sum /= chd[i];
}
System.out.println("请支付" + sum + "元");
int s = scanner.nextInt();
if (s > sum) {
System.out.println("支付成功!找零:" + (s - sum) + "\n欢迎您下次光临!");
name[i] = name[i + 1];
phone[i] = phone[i + 1];
cat[i] = cat[i + 1];
dates[i] = dates[i + 1];
} else {
System.out.println("支付失败!");
}
v = false;
break;
}
}
if (v) {
System.out.println("未找到!");
}
break;
case 5:
System.out.println("车型名称\t\t车牌号\t日租金\t\t折扣\t\t租赁状态\n");
i = 0;
while(true) {
if (i >= cName.length) {
continue label189;
}
if (cName[i] != null) {
if (czt[i]) {
a = "在库";
} else {
a = "借出";
}
System.out.println(cName[i] + "\t\t" + cID[i] + "\t\t" + cDL[i] + "\t\t大于3天0." + chd[i] + "折,反之不打折\t\t" + a);
}
++i;
}
case 6:
System.out.println("租车人姓名\t 租车人电话 \t租车具体信息 \t\t租车开始时间");
i = 0;
while(true) {
if (i >= name.length) {
continue label189;
}
if (name[i] != null) {
System.out.println(name[i] + "\t" + phone[i] + "\t" + cat[i] + "\t" + dates[i] + "号");
}
++i;
}
case 7:
i = 0;
while(true) {
System.out.println("退出!!!");
if (i == 9999) {
return;
}
++i;
}
}
}
}
}
java汽车租借系统
最新推荐文章于 2024-11-04 20:33:37 发布