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

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

參考了很多的大神的代碼,有些地方看不懂,我用一個(gè)上午的時(shí)間用自己的能夠理解的代碼寫的,通俗易懂些,但是有很多不足,希望大神指點(diǎn),提多多的意見(jiàn)!

public??class?Car?{
	private?int?carNumber;
	private?String?carName;
	private?int?carRentMoney;
	
	public?int?getCarNumber()?{
		return?carNumber;
	}
	public?void?setCarNumber(int?carNumber)?{
		this.carNumber?=?carNumber;
	}
	public?String?getCarName()?{
		return?carName;
	}
	public?void?setCarName(String?carName)?{
		this.carName?=?carName;
	}
	public?int?getCarRentMoney()?{
		return?carRentMoney;
	}
	public?void?setCarRentMoney(int?carRentMoney)?{
		this.carRentMoney?=?carRentMoney;
	}
}

public?class?passengerCar?extends?Car?{
	private?int?CarCapacity;
	public?passengerCar(int?carNumber,String?carName,int?carRentMoney,int?carCapacity){
		this.setCarNumber(carNumber);
		this.setCarName(carName);
		this.setCarRentMoney(carRentMoney);
		CarCapacity?=?carCapacity;
	}

	public?int?getCarCapacity()?{
		return?CarCapacity;
	}

	public?void?setCarCapacity(int?carCapacity)?{
		CarCapacity?=?carCapacity;
	}
}

public?class?pickUp?extends?Car?{
	private?int?CarCapacity;
	private?int?CarCarry;
	
	public?pickUp(int?carNumber,String?carName,int?carRentMoney,int?CarCapacity,int?CarCarry){
		this.setCarNumber(carNumber);
		this.setCarName(carName);
		this.setCarRentMoney(carRentMoney);
		this.CarCapacity?=?CarCapacity;
		this.CarCarry?=?CarCarry;
		
	}
	public?int?getCarCapacity()?{
		return?CarCapacity;
	}
	public?void?setCarCapacity(int?carCapacity)?{
		CarCapacity?=?carCapacity;
	}
	public?int?getCarCarry()?{
		return?CarCarry;
	}
	public?void?setCarCarry(int?carCarry)?{
		CarCarry?=?carCarry;
	}

}

public?class?trunkCar?extends?Car?{
	private?int?CarCarry;
	
	public?trunkCar(int?carNumber,String?carName,int?carRentMoney,int?CarCarry){
		this.setCarNumber(carNumber);
		this.setCarName(carName);
		this.setCarRentMoney(carRentMoney);
		this.CarCarry?=?CarCarry;
		
	}
	public?int?getCarCarry()?{
		return?CarCarry;
	}

	public?void?setCarCarry(int?carCarry)?{
		CarCarry?=?carCarry;
	}
}

import?java.util.Scanner;
public?class?Test?{

	/**
	?*?@param?args
	?*/
	public?static?void?main(String[]?args)?{
		//?TODO?Auto-generated?method?stub
		System.out.println("歡迎使用答答租車系統(tǒng):");
		System.out.println("你是否要租車???1是????2否");
		Scanner?s?=?new?Scanner(System.in);
		int??k?=?s.nextInt();
		if(k?==?1){
			System.out.println("您可租車的類型及其價(jià)格表:");
			Car?RentCar[]?=?{new?passengerCar(1,"奧迪A4",500,4),new?passengerCar(2,"馬自達(dá)6",400,4),new?pickUp(3,"皮卡雪6",450,4,2),new?passengerCar(4,"金龍",800,20),new?trunkCar(5,"松花江",400,4),new?trunkCar(6,"依維柯",1000,20)};
			System.out.println("序號(hào)"+"\t"+"汽車名稱"+"\t"+"\t"+"租金"+"\t"+"容量");
			for(int?i?=?0;?i?<?6;?i++){
				////若RentCar[i]它是客車類型的實(shí)例,則打印出客車應(yīng)該有的屬性值,這里注意強(qiáng)轉(zhuǎn),否則不會(huì)出現(xiàn)
				if(RentCar[i]?instanceof?passengerCar){
				System.out.println(RentCar[i].getCarNumber()+"\t"+RentCar[i].getCarName()+"\t"+"\t"+RentCar[i].getCarRentMoney()+"/天"+"\t"+"載人:"+((passengerCar)RentCar[i]).getCarCapacity()+"人");//將Car類型強(qiáng)制轉(zhuǎn)換成passengerCar類,得到passegerCard的屬性
				}
				if(RentCar[i]?instanceof?pickUp){
					System.out.println(RentCar[i].getCarNumber()+"\t"+RentCar[i].getCarName()+"\t"+"\t"+RentCar[i].getCarRentMoney()+"/天"+"\t"+"載人:"+((pickUp)RentCar[i]).getCarCapacity()+"人??載貨:"+((pickUp)RentCar[i]).getCarCarry()+"噸");
				}
				if(RentCar[i]?instanceof?trunkCar){
					System.out.println(RentCar[i].getCarNumber()+"\t"+RentCar[i].getCarName()+"\t"+"\t"+RentCar[i].getCarRentMoney()+"/天"+"\t"+"載人:"+((trunkCar)RentCar[i]).getCarCarry()+"噸");
				}
			}
			System.out.println("請(qǐng)輸入您要租汽車的數(shù)量:");
			//已經(jīng)有Scanner對(duì)象,直接調(diào)用
			int?totalNum?=?s.nextInt();
			int?sum?=?0;
			for(int?j?=?1;?j?<=?totalNum;?j++){
				System.out.println("請(qǐng)輸入第"+j+"輛車的序號(hào)");
				int?q?=?s.nextInt();
				switch(q){
				case?1:
					?RentCar[0].getCarRentMoney();
				case?2:
					RentCar[1].getCarRentMoney();
				case?3:
					RentCar[2].getCarRentMoney();
				case?4:
					RentCar[3].getCarRentMoney();
				case?5:
					RentCar[4].getCarRentMoney();
				case?6:
					RentCar[5].getCarRentMoney();
				}
				sum?=?sum?+?RentCar[q-1].getCarRentMoney();
			}
				System.out.println("請(qǐng)輸入租車的天數(shù):");
				int?day?=?s.nextInt();
				System.out.println("您的賬單:");
				System.out.println(sum?*?day);
				
			
			
		}
		

	}

}


正在回答

1 回答

怎么截圖的?。繉懙貌诲e(cuò)!

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

舉報(bào)

0/150
提交
取消

參考了很多的大神的代碼,有些地方看不懂,我用一個(gè)上午的時(shí)間用自己的能夠理解的代碼寫的,通俗易懂些,但是有很多不足,希望大神指點(diǎn),提多多的意見(jià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)