這個(gè)程序執(zhí)行不了,哪里出錯(cuò)了
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;//總?cè)藬?shù)
??int good=0;//一款車子的載物量
??int goods=0;//總載物量
??
??Scanner input=new Scanner(System.in);
??int x=input.nextInt();
??do{
???System.out.println("歡迎來到答答租車系統(tǒng)!");
???System.out.println("你是否要租車:1是 ,0否");
???if(x==0){
????System.out.println("期待你的下次光臨!");
???}
??}
???while(x==0);
???
????System.out.println("您可租車的類型和及其項(xiàng)目表:");
????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;//一輛車子的載人數(shù)目
???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="馬自達(dá)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("請輸入租車的數(shù)量:");??
????????int n=input.nextInt();//租車的數(shù)量
????????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("請輸入租車天數(shù):");
?????????int days=input.nextInt();
?????????System.out.println("您的賬單:");
?????????System.out.println("所載人人數(shù)為:"+persons);
?????????System.out.println("所載貨物量為:"+goods);
?????????System.out.println("***租金總價(jià)格為:"+(moneys*days));
???????????
?????????
????????}
????????
????????
???????}
??????
?????}
????}
??
2017-03-28
zhong wen shu ru fa zhao bu dao le...555555.
2017-03-28
jie kou he lei de sheng ming cuo wu le .
2017-03-28
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;//總?cè)藬?shù)
?int good=0;//一款車子的載物量
?int goods=0;//總載物量
?
?Scanner input=new Scanner(System.in);
?System.out.println("歡迎來到答答租車系統(tǒng)!");
?System.out.println("你是否要租車:1是 ,0否");
?int x=input.nextInt();
?do{
??
? if(x==0){
? ?System.out.println("期待你的下次光臨!");
? }
?}while(x==0);
??
?System.out.println("您可租車的類型和及其項(xiàng)目表:");
?System.out.println("序號"+ ?"汽車名稱"+ ?"租金"+ ? ?"容量");
?if(x==1){?
? ? A1.input();
? ? A2.input();
? ? A3.input();
? ? A4.input();
? ? A5.input();
? ? A6.input();
?}
?
?System.out.println("請輸入租車的數(shù)量:"); ?
? ? ? int n=input.nextInt();//租車的數(shù)量
? ? ? 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("請輸入租車天數(shù):");
? ? ? ?int days=input.nextInt();
? ? ? ?System.out.println("您的賬單:");
? ? ? ?System.out.println("所載人人數(shù)為:"+persons);
? ? ? ?System.out.println("所載貨物量為:"+goods);
? ? ? ?System.out.println("***租金總價(jià)格為:"+(moneys*days));
?
}
public static class car1{
private int num=1;//車子的序號
private String name="歐迪A4";//車子的名稱
private int money=500;//一天的租金
private int person=4;//一輛車子的載人數(shù)目
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="馬自達(dá)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()+" "+"噸");
? ? ? ?}
? ? ?}
}