第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

研究了兩天的代碼,求大神指點(diǎn)

//父類

package com.tow;


public abstract class Car {

int number;

String name;

float price;

public Car(int number,String name,float price){

this.number=number;

this.name=name;

this.price=price;

}

? ? @Override

public String toString() {

return number+"\t"+name+"\t"+price+"\n";

}


public int getCarcapacity() {

// TODO Auto-generated method stub

return 0;

}


public int getTrackcapacity() {

// TODO Auto-generated method stub

return 0;

}


? ??

}

//子類1

package com.tow;


public class Cars extends Car {

private int Carcapacity;

public Cars(int number, String name, float price,int Carcapacity) {

super(number, name, price);

this.setCarcapacity(Carcapacity);

// TODO Auto-generated constructor stub

}


public int getCarcapacity() {

return Carcapacity;

}


public void setCarcapacity(int carcapacity) {

Carcapacity = carcapacity;

}


@Override

public String toString() {

return number+"\t"+name+"\t"+price+"\t\t"+Carcapacity+"\n";

}


}

//子類2

package com.tow;


public class Track extends Car {

private int Trackcapacity;

public Track(int number, String name, float price,int Trackcapacity) {

super(number, name, price);

this.setTrackcapacity(Trackcapacity);

// TODO Auto-generated constructor stub

}



public int getTrackcapacity() {

return Trackcapacity;

}


public void setTrackcapacity(int trackcapacity) {

Trackcapacity = trackcapacity;

}


@Override

public String toString() {

return number+"\t"+name+"\t"+price+"\t\t\t"+Trackcapacity+"\n";

}


}

//子類3

package com.tow;


public class Pickup extends Car {

private int Carcapacity;

private int Trackcapacity;

public Pickup(int number, String name, float price,int Carcapacity,int Trackcapacity) {

super(number, name, price);

this.setCarcapacity(Carcapacity);

this.setTrackcapacity(Trackcapacity);

// TODO Auto-generated constructor stub

}

public int getCarcapacity() {

return Carcapacity;

}

public void setCarcapacity(int carcapacity) {

Carcapacity = carcapacity;

}

public int getTrackcapacity() {

return Trackcapacity;

}

public void setTrackcapacity(int trackcapacity) {

Trackcapacity = trackcapacity;

}

@Override

public String toString() {

return number+"\t"+name+"\t"+price+"\t\t"+Carcapacity+"\t"+Trackcapacity+"\n";

}


}

//測(cè)試類

package com.tow;

import java.util.*;

public class Initail {


public static void main(String[] args) {

// TODO Auto-generated method stub

? ? @SuppressWarnings("resource")

Scanner input=new Scanner (System.in);

? ? System.out.println("##歡迎使用DADA租車系統(tǒng)##");

? ? System.out.println("請(qǐng)問(wèn)您是否租車:1.是,2.否");

? ? int choice=input.nextInt();

? ? switch(choice){

? ? case 1:

? ? System.out.println("下面是租車信息:");

? ? System.out.println("序號(hào)"+"\t"+"車型"+"\t"+"單價(jià)(天/元)"+"\t"+"載客以及載貨量(t)");

? ? Car[] news=new Car[5];

? ? news[0]=new Cars(1,"奧迪A8",800,5);

? ? news[1]=new Cars(2,"金龍大巴",700,50);

? ? news[2]=new Track(3,"金杯",400,45);

? ? news[3]=new Track(4,"東風(fēng)悅達(dá)",650,70);

? ? news[4]=new Pickup(5,"皮卡",500,4,60);

? ? System.out.println(Arrays.toString(news));

? ? System.out.print("請(qǐng)您輸入租賃天數(shù):");

? ? ?int day=input.nextInt();

? ? ?System.out.println("租用:"+day+"天");

? ? ?System.out.println("請(qǐng)您根據(jù)車型序號(hào)選擇車型,輸入“8”結(jié)束");

? ? ?int[] rent=new int[6];

? ? for(int i=1;i<6;i++){

? ?

? ? ? ? System.out.print("請(qǐng)輸入您要選擇的車型:");

? ? ? ? ? int score1=input.nextInt();

? ? ? ? ? if(score1==8){

? ? ? ? break;

? ? ? ? ? }else{

? ? ? ? ? ?System.out.print("請(qǐng)輸入您要組的數(shù)量:");

? ? ? ? ? ?int score2=input.nextInt();

? ? ? ? ? ?float sum=news[score1-1].price*day;

? ? ? ? ? ?System.out.println("車型:"+news[score1-1].name+"\t"+score2+"輛"+"\t"+"合計(jì)"+sum+"元");?

? ? ? ? ? ?float sum2=0;

? ? ? ? ? ?sum2=sum+sum2;

? ? ? ? ? ?System.out.println("總計(jì):"+sum2);

? ? ? ? ? ?rent[score1]=score2;

? ? }

? ? ? ? ??

? ? }

? ?

? ? System.out.println("如下是您的租車信息,請(qǐng)您核對(duì):");

? ? float sum=0;

? ? for(int i=0;i<6;i++){

? ? if(rent[i]!=0){

? ? System.out.println(news[i-1].name+":\t"+rent[i]+"輛"+"\t"+"單價(jià)(元/天):"+rent[i]*news[i-1].price+"\t\t"+"載客量:"+"\t"+rent[i]*news[i-1].getCarcapacity()+"人"+

? ? ? ? "\t"+"載重量:"+rent[i]*news[i-1].getTrackcapacity()+"噸"+"\t"+"合計(jì):"+rent[i]*(rent[i]*news[i-1].price)*day+"元");

? ? sum+=rent[i]*rent[i]*news[i-1].price*day;

? ? }

? ?

? ? }

? ? System.out.println("租車總費(fèi)用:"+sum+"元");

? ? break;

? ? case 2:

? ? System.out.println("歡迎使用,再見(jiàn)!");

? ? break;

? ? default:

? ? System.out.println("您的輸入有誤,請(qǐng)重新輸入!");

? ? }

? ??

}


}


正在回答

1 回答

可以去面試去了

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

研究了兩天的代碼,求大神指點(diǎn)

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)