2008年1月4日 星期五

Lab Magic Parking Tower

A parking tower is out of order someday. If you park a Benz, you will end up with a Torben. Write a program to simulate this scenario. First create a class called CarParked which has a method called outOfOrder. Name an object called yourCar, which happens to be a Benz. Your program should contain a class called CarParked and a test program called CarParkedDemo.

1.

















(附) toString 用為將最後的輸出型態轉為 String。
故,brand 已為 String 型態,所以再用 toString 做轉換輸出,不好。

2.

















(改進版)
1.

















2.

沒有留言: