?? motorcyle.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 + -