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

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

Java入門第二階段6.1達(dá)達(dá)租車系統(tǒng)

標(biāo)簽:
Java
package imook_dada;

abstract class Car {

	int price;

	public abstract void showInfro();

}

abstract class keche extends Car{

	int zaike;

	public abstract void showInfro();

}

public class dakeche extends keche{

	String name = new String("大客车");

	dakeche(){

		this.price = 400;

		this.zaike = 10;

	}

@Override

	public void showInfro() {

		// TODO Auto-generated method stub

		System.out.println("2." + name + " " + zaike + "人 " + price + "元/天");

	}

}

public class xiaokeche extends keche{

	String name = new String("小客车");

	xiaokeche(){

		this.price = 200;

		this.zaike = 5;

	}

@Override

	public void showInfro() {

		// TODO Auto-generated method stub

		System.out.println("1." + name + " " + zaike + "人 " + price + "元/天");

	}

}

public abstract class huoche extends Car{

	int zaihuo;

	public abstract void showInfro();

}

public class xiaohuoche extends huoche{

	String name = new String("小货车");

	xiaohuoche(){
	
	this.price = 300;

	this.zaihuo = 5;

	}

	@Override

	public void showInfro() {

		// TODO Auto-generated method stub

		System.out.println("3." + name + " " + zaihuo + "吨 " + price + "元/天");

	}

}

public class dahuoche extends huoche{

	String name = new String("大货车");

	dahuoche(){

		this.price = 700;

		this.zaihuo = 20;

	}

@Override

	public void showInfro() {
	
		// TODO Auto-generated method stub

		System.out.println("4." + name + " " + zaihuo + "吨 " + price + "元/天");

	}

}

public class pika extends Car{

	int zake;

	int zaihuo;

	String name = new String("皮卡");

	pika(){

		this.price = 300;

		this.zaihuo = 2;

		this.zake = 4;

	}

@Override

	public void showInfro() {

		// TODO Auto-generated method stub

		System.out.println("5." + name + " " + zaihuo + "吨 " + zake + "人 " + price + "元/天");

	}

}

//下面是租车程序

package imook_dada;

import java.util.Scanner;



public class Dadarent {

static int totalNum = 0;

static int totalPrice = 0;

static int choise = 0;

static int carType = 0;

static int carNum = 0;

static xiaokeche Dada_xiaokeche = new xiaokeche();

static dakeche Dada_dakeche = new dakeche();

static xiaohuoche Dada_xiaohuoche = new xiaohuoche();

static dahuoche Dada_dahuoche = new dahuoche();

static pika Dada_pika = new pika();

static Scanner sc = new Scanner(System.in);

static int[] carPrice = {200,400,300,700,300};//录入车辆的价格,与序号对应

public static void main(String[] args) {

// TODO Auto-generated method stub

String Start = new String("请问您是否需要租车?\n 1.是    2.否");

String Service1 = new String("本公司提供如下车型:");

String Service2 = new String("请选择您想要租的车型");

String Service3 = new String("请输入您想要租的数目:");

String Service4 = new String("请问您是否想要继续租车?\n 1.是    2.否");

String Service5 = new String("您一共需要支付:");

String notation = new String("请输入正确选项,谢谢合作");

String Goodbey = new String("感谢您使用达达租车系统,再见。");

System.out.println(Start);

choise = sc.nextInt();

System.out.println(choise);

while(choise !=1 && choise !=2) {

System.out.println(notation);

System.out.println(Service2);

choise = sc.nextInt();

}

if(choise == 2) {

System.out.println(Goodbey);

return ;

}

else {

while(choise == 1) {

System.out.println(Service1);

Dada_showInfro();

System.out.println(Service2);

carType = sc.nextInt();

System.out.println(Service3);

carNum = sc.nextInt();

totalPrice += carPrice[carType-1] * carNum;

System.out.println(Service4);

choise = sc.nextInt();

}

System.out.println(Service5 + totalPrice);

System.out.println(Goodbey);

return ;

}

}

public static void Dada_showInfro() {

Dada_xiaokeche.showInfro();

Dada_dakeche.showInfro();

Dada_xiaohuoche.showInfro();

Dada_dahuoche.showInfro();

Dada_pika.showInfro();

}



}


​
點(diǎn)擊查看更多內(nèi)容
TA 點(diǎn)贊

若覺得本文不錯(cuò),就分享一下吧!

評(píng)論

作者其他優(yōu)質(zhì)文章

正在加載中
  • 推薦
  • 評(píng)論
  • 收藏
  • 共同學(xué)習(xí),寫下你的評(píng)論
感謝您的支持,我會(huì)繼續(xù)努力的~
掃碼打賞,你說多少就多少
贊賞金額會(huì)直接到老師賬戶
支付方式
打開微信掃一掃,即可進(jìn)行掃碼打賞哦
今天注冊有機(jī)會(huì)得

100積分直接送

付費(fèi)專欄免費(fèi)學(xué)

大額優(yōu)惠券免費(fèi)領(lǐng)

立即參與 放棄機(jī)會(huì)
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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

舉報(bào)

0/150
提交
取消