driver.java
来自「Java程序设计(美) David D. Riley著 机械工业出版社 书籍配套」· Java 代码 · 共 29 行
JAVA
29 行
/** Parcels Program (Figures 8.2, 8.4, & 8.5) * Author: David Riley * Date: January, 2005 */public class Driver { public Driver() { Parcel someParcel; RectangularParcel box; CylindricalParcel cylinder; someParcel = new Parcel( 0.56, 0.3, true ); System.out.println( "Cost to ship: " + someParcel.shippingCost() ); box = new RectangularParcel( 1.1, 0.5, 0.3, false ); System.out.println( "Length, Width, Height: " + box.length() + ", " + box.width() + ", " + box.height() ); System.out.println( "Weight, Volume: " + box.weight + ", " + box.volume ); System.out.println( "Cost to ship: " + box.shippingCost() ); cylinder = new CylindricalParcel( 2, .5 ); System.out.println( "Length, Radius: " + cylinder.length() + ", " + cylinder.radius() ); System.out.println( "Weight, Volume: " + cylinder.weight + ", " + cylinder.volume ); System.out.println( "Cost to ship: " + cylinder.shippingCost() ); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?