Vehicle類 package d A public class Vehicle private int wheels private double weight Vehicle weight wheels Vehicle int lun, double zizhong wheels lun weight zizhong public int getWheels return wheels p ...
2016-09-22 17:37 0 6312 推薦指數:
#29.編寫一個Java應用程序,設計一個汽車類Vehicle,包含的屬性有車輪個數 wheels和車重weight。小車類Car是Vehicle的子類,其中包含的屬性有載人數 loader。卡車類Truck是Car類的子類,其中包含的屬性有載重量payload。每個 類都有構造方法和輸出 ...
package com.hanqi.test; public class jidongche { private String chepaihao;//車牌號 private int speed;//速度 private double weight;//載重量 //無參構造方法 ...
package com.hanqi.test; public class Car { private String carNo; private int speed; private double support; public Car() { carNo="XX1234"; speed=100 ...
//矩形父類 package d922A; public class Rect { private double l,w; Rect(double c,double k) { l=c; w=k; } public double s() { return w*l; } } ///立方體類 ...