import java.util.*;
public class Test {
public static void main(String[]args){
car1 A1=new car1();
car2 A2=new car2();
car3 A3=new car3();
car4 A4=new car4();
car5 A5=new car5();
car6 A6=new car6();
int money=0;//一款车子的租金
int moneys=0;//一天的租金
int person=0;//一款车子的载人量
int persons=0;//总人数
int good=0;//一款车子的载物量
int goods=0;//总载物量
Scanner input=new Scanner(System.in);
int x=input.nextInt();
do{
System.out.println("欢迎来到答答租车系统!");
System.out.println("你是否要租车:1是 ,0否");
if(x==0){
System.out.println("期待你的下次光临!");
}
}
while(x==0);
System.out.println("您可租车的类型和及其项目表:");
System.out.println("序号"+ "汽车名称"+ "租金"+ "容量");
if(x==1){
A1.output();
A2.output();
A3.output();
A4.output();
A5.output();
A6.output();
}
class car1 {
private int num=1;//车子的序号
private String name="欧迪A4";//车子的名称
private int money=500;//一天的租金
private int person=4;//一辆车子的载人数目
public int getNum(){
return num;
}
public String getName(){
return name;
}
public int getMoney(){
return money;
}
public int getPerson(){
return person;
}
public void input(){
System.out.println(getNum()+" "+getName()+" "+getMoney()+"元/天"+""+"载人"+getPerson()+"人");
}
class car2{
private int num=2;
private String name="马自达6";
private int money=400;
private int person=4;
public int getnum2(){
return num;
}
public String getName(){
return name;
}
public int getMoney(){
return money;
}
public int getPerson(){
return person;
}
public void input(){
System.out.println(getNum()+" "+getName()+" "+getMoney()+"元/天"+""+"载人"+getPerson()+"人");
}
class car3{
private int num=3;
private String name="皮卡雪6";
private int money=450;
private int person=4;
private int good=2;
public int getnum3(){
return num;
}
public String getName(){
return name;
}
public int getMoney(){
return money;
}
public int getPerson(){
return person;
}
public int getGood(){//皮卡雪6的载物量
return good;
}
public void input(){
System.out.println(getNum()+""+getName()+""+getMoney()+"元/天"+""+"载人"+getPerson()+"载物"+getGood()+"吨");
}
class car4{
private int num=4;
private String name="金龙";
private int money=800;
private int person=20;
public int getnum4(){
return num;
}
public String getName(){
return name;
}
public int getMoney(){
return money;
}
public int getPerson(){
return person;
}
public void input(){
System.out.println(getNum()+""+getName()+""+getMoney()+"元/天"+""+"载人"+getPerson()+"人");
}
class car5{
private int num=5;
private String name="松花江";
private int money=400;
private int good=4;
public int getnum5(){
return num;
}
public String getName(){
return name;
}
public int getMoney(){
return money;
}
public int getGoods(){//松花江的载物量
return good;
}
public void input(){
System.out.println(getNum()+""+getName()+""+getMoney()+"元/天"+"载物"+getGoods()+"吨");
}
class car6{
private int num=6;
private String name="依维柯";
private int money=1000;
private int good=20;
public int getnum6(){
return num;
}
public String getName(){
return name;
}
public int getMoney(){
return money;
}
public int getGood1(){//依维柯的载物量
return good;
}
public void input(){
System.out.println(getNum()+""+getMoney()+""+"载物"+getGood1()+"吨");
}
System.out.print("请输入租车的数量:");
int n=input.nextInt();//租车的数量
for(int i=0;i<n;i++){
System.out.println("请输入第"+(i+1)+"+辆车的序号:");
int num=input.nextInt();
switch(num){
case 1:
money=A1.getMoney();//车子的租金
person=A1.getPerson();
break;
case 2:
money=A2.getMoney();
person=A2.getPerson();
break;
case 3:
money=A3.getMoney();
person=A3.getPerson();
good=A4.getGood();
break;
case 4:
money=A4.getMoney();
person=A4.getPerson();
break;
case 5:
money=A5.getMoney();
goods=A5.getGood();
break;
case 6:
money=A6.getMoney();
good=A6.getGood();
break;
}
moneys=moneys+money;
persons=persons+person;
goods=goods+good;
}
System.out.println("moneys="+moneys);
System.out.printn("persons="+persons);
Systme.out.println("goods="+goods);
System.out.println("请输入租车天数:");
int days=input.nextInt();
System.out.println("您的账单:");
System.out.println("所载人人数为:"+persons);
System.out.println("所载货物量为:"+goods);
System.out.println("***租金总价格为:"+(moneys*days));
}
}
}
}
zhong wen shu ru fa zhao bu dao le...555555.
jie kou he lei de sheng ming cuo wu le .
import java.util.*;
public class ceshi {
public static void main(String[] args) {
// TODO Auto-generated method stub
car1 A1=new car1();
car2 A2=new car2();
car3 A3=new car3();
car4 A4=new car4();
car5 A5=new car5();
car6 A6=new car6();
int money=0;//一款车子的租金
int moneys=0;//一天的租金
int person=0;//一款车子的载人量
int persons=0;//总人数
int good=0;//一款车子的载物量
int goods=0;//总载物量
Scanner input=new Scanner(System.in);
System.out.println("欢迎来到答答租车系统!");
System.out.println("你是否要租车:1是 ,0否");
int x=input.nextInt();
do{
if(x==0){
System.out.println("期待你的下次光临!");
}
}while(x==0);
System.out.println("您可租车的类型和及其项目表:");
System.out.println("序号"+ "汽车名称"+ "租金"+ "容量");
if(x==1){
A1.input();
A2.input();
A3.input();
A4.input();
A5.input();
A6.input();
}
System.out.println("请输入租车的数量:");
int n=input.nextInt();//租车的数量
for(int i=0;i<n;i++){
System.out.println("请输入第"+(i+1)+"+辆车的序号:");
int num=input.nextInt();
switch(num){
case 1:
money=A1.getMoney();//车子的租金
person=A1.getPerson();
break;
case 2:
money=A2.getMoney();
person=A2.getPerson();
break;
case 3:
money=A3.getMoney();
person=A3.getPerson();
good=A3.getGoods();
break;
case 4:
money=A4.getMoney();
person=A4.getPerson();
break;
case 5:
money=A5.getMoney();
goods=A5.getGoods();
break;
case 6:
money=A6.getMoney();
good=A6.getGoods();
break;
}
moneys=moneys+money;
persons=persons+person;
goods=goods+good;
}
System.out.println("moneys="+moneys);
System.out.println("persons="+persons);
System.out.println("goods="+goods);
System.out.println("请输入租车天数:");
int days=input.nextInt();
System.out.println("您的账单:");
System.out.println("所载人人数为:"+persons);
System.out.println("所载货物量为:"+goods);
System.out.println("***租金总价格为:"+(moneys*days));
}
public static class car1{
private int num=1;//车子的序号
private String name="欧迪A4";//车子的名称
private int money=500;//一天的租金
private int person=4;//一辆车子的载人数目
public int getNum(){
return num;
}
public String getName(){
return name;
}
public int getMoney(){
return money;
}
public int getPerson(){
return person;
}
public void input(){
System.out.println(getNum()+" "+getName()+" "+getMoney()+"元/天"+""+"载人"+getPerson()+"人");
}
}
public static class car2{
private int num=2;
private String name="马自达6";
private int money=400;
private int person=4;
public int getNum(){
return num;
}
public String getName(){
return name;
}
public int getMoney(){
return money;
}
public int getPerson(){
return person;
}
public void input(){
System.out.println(getNum()+" "+getName()+" "+getMoney()+"元/天"+""+"载人"+getPerson()+"人");
}
}
public static class car3{
private int num=3;
private String name="皮卡雪6";
private int money=450;
private int person=4;
private int good=2;
public int getNum(){
return num;
}
public String getName(){
return name;
}
public int getMoney(){
return money;
}
public int getPerson(){
return person;
}
public int getGoods(){//皮卡雪6的载物量
return good;
}
public void input(){
System.out.println(getNum()+""+getName()+""+getMoney()+"元/天"+""+"载人"+getPerson()+"载物"+getGoods()+"吨");
}
}
public static class car4{
private int num=4;
private String name="金龙";
private int money=800;
private int person=20;
public int getNum(){
return num;
}
public String getName(){
return name;
}
public int getMoney(){
return money;
}
public int getPerson(){
return person;
}
public void input(){
System.out.println(getNum()+""+getName()+""+getMoney()+"元/天"+""+"载人"+getPerson()+"人");
}
}
public static class car5{
private int num=5;
private String name="松花江";
private int money=400;
private int good=4;
public int getNum(){
return num;
}
public String getName(){
return name;
}
public int getMoney(){
return money;
}
public int getGoods(){//松花江的载物量
return good;
}
public void input(){
System.out.println(getNum()+""+getName()+""+getMoney()+"元/天"+"载物"+getGoods()+"吨");
}
}
public static class car6{
private int num=6;
private String name="依维柯";
private int money=1000;
private int good=20;
public int getNum(){
return num;
}
public String getName(){
return name;
}
public int getMoney(){
return money;
}
public int getGoods(){//依维柯的载物量
return good;
}
public void input(){
System.out.println(getNum()+" "+getMoney()+" "+"载物"+getGoods()+" "+"吨");
}
}
}