⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 motorcyle.java

📁 一个租车行的图形用户界面程序,可根据顾客的要求选择车辆
💻 JAVA
字号:


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Motorcyle extends Motorvehicle implements Property
{
	
	int engineStrokes;// number of strokes of the engine 
	leaser motorcyleleaser;
	
	private static int count_Motorcyle=0;
	private static String MotorcyleAdmin="MOtorcylePerson";
	
	public Motorcyle()
	{
		Motorcyle_total();
	}
	
	public Motorcyle(String T,String N,int v,int c,int h,int E,String M,int Y)
	{
		Motorcyle_total();
		this.type=T;
		this.name=N;
		this.value=v;
		this.cc=c;
		this.hp=h;
		this.engineStrokes=E;
		this.ID=String.format("%04d", veh.count_vehicle);
		this.date.year=Y;
	}
		
	public float calculateValue()
	{
		return (float) (value*0.5);
	}
	
	public String getAdmin()
	{
		return MotorcyleAdmin;
	} 
	
	 public String toString()
	{
		return(super.toString()+"engineStrokes:   "+engineStrokes+"\n"+
		         "the person responsible for this vehicle:"+getAdmin()+
		         "\n"+"estimated value  :"+calculateValue()+"\n"+motorcyleleaser+"\n\n");
	}
	
	public static void Motorcyle_total()
	{
		count_Motorcyle++;
	}
	
	public static int show_count_Motorcyle()
	{
		return count_Motorcyle;
	}
	
	public void addMotorcyle()throws IOException
    {
		this.addMotorvehicle();
		
		BufferedReader in =new BufferedReader(new InputStreamReader(System.in));
		
		boolean valid;
		
		valid=false;
		
		while(!valid)
		{
			System.out.print("Input the number of strokes of the engine:   ");
			try{
				this.engineStrokes=(new Integer(in.readLine())).intValue();
				valid=true;
				}catch(NumberFormatException e)
				{
					System.out.println("输入错误!");
				}
		}
		this.motorcyleleaser=new leaser();
		this.motorcyleleaser.set_leaser();
		
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -