資源簡介
[問題描述]
設(shè)停車廠只有一個(gè)可停放幾輛汽車的狹長通道,且只有—個(gè)大門可供汽車進(jìn)出。汽車在停車場內(nèi)按車輛到達(dá)的先后順序依次排列,若車場內(nèi)已停滿幾輛汽車,則后來的汽車只能在門外的便道上等候, 一旦停車場內(nèi)有車開走,則排在便道上的第一輛車即可進(jìn)入;當(dāng)停車場內(nèi)某輛車要離開時(shí),由于停車場是狹長的通道,在它之后開入的車輛必須先退出車場為它讓路,待該車輛開出大門,為它讓路的車輛再按原次序進(jìn)入車場。在這里假設(shè)汽車不能從便道上開走,試設(shè)汁這樣一個(gè)停車廠模擬管理程序。為了以下描述的方便,停車廠的停車場用“停車位”進(jìn)行敘述,停車廠的便道用“便道”進(jìn)行敘述。
[數(shù)據(jù)結(jié)構(gòu)設(shè)計(jì)]
代碼片段和文件信息
/*
?*?@(#)Car.java??2008-12-20
?*?
?*?Copyright?STF?
?*/
package?edu.cqit.ParkSimulation;
/**
?*?汽車類Car
,記錄汽車的牌照號碼和汽車的當(dāng)前狀態(tài),當(dāng)前狀態(tài)用于區(qū)分每輛汽車
?*?所處的位置。
?*?
?*?@author?StarFineJade
?*?
?*/
public?class?Car?{
//?
//?汽車可能的停放位置
//?
/**?指示Car
當(dāng)前停放在停車場中?用于setState
?*/
public?static?final?int? ON_STOPPTING? =?0;
/**?指示Car
當(dāng)前停放在便道上?用于setState
?*/
public?static?final?int? ON_PAVEMENT? =?1;
/**?指示Car
當(dāng)前在其他地方?用于setState
?*/
public?static?final?int? ON_OTHER_PLACE? =?3;
//?
//?汽車屬性
//?
/**?
?*?記錄Car
牌照號碼?
?*?@see?#getLicensePlate()
?*/
private?final?String? licensePlate;
/**??
?*?記錄Car
的當(dāng)前狀態(tài),?一下常量之一:
?*?ON_STOPPING
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件??????11274??2008-12-28?12:34??停車場模擬管理程序\Image\car_icon.jpg
?????文件???????6102??2008-08-26?19:09??停車場模擬管理程序\Image\icon_come.gif
?????文件???????6947??2008-08-26?20:04??停車場模擬管理程序\Image\icon_leave.gif
?????文件??????28896??2009-01-01?13:45??停車場模擬管理程序\parking.jar
?????文件???????2930??2009-01-02?13:54??停車場模擬管理程序\src\edu\cqit\ParkSimulation\allclasses-fr
?????文件???????2570??2009-01-02?13:54??停車場模擬管理程序\src\edu\cqit\ParkSimulation\allclasses-nofr
?????文件???????2437??2008-12-28?00:15??停車場模擬管理程序\src\edu\cqit\ParkSimulation\Car.java
?????文件???????7574??2009-01-02?13:54??停車場模擬管理程序\src\edu\cqit\ParkSimulation\constant-values.html
?????文件???????4798??2009-01-02?13:54??停車場模擬管理程序\src\edu\cqit\ParkSimulation\deprecated-list.html
?????文件??????14686??2009-01-02?13:54??停車場模擬管理程序\src\edu\cqit\ParkSimulation\edu\cqit\ParkSimulation\Car.html
?????文件??????27802??2009-01-02?13:54??停車場模擬管理程序\src\edu\cqit\ParkSimulation\edu\cqit\ParkSimulation\ImageButton.html
?????文件??????20704??2009-01-02?13:54??停車場模擬管理程序\src\edu\cqit\ParkSimulation\edu\cqit\ParkSimulation\li
?????文件??????27895??2009-01-02?13:54??停車場模擬管理程序\src\edu\cqit\ParkSimulation\edu\cqit\ParkSimulation\MessagePanel.html
?????文件??????17771??2009-01-02?13:54??停車場模擬管理程序\src\edu\cqit\ParkSimulation\edu\cqit\ParkSimulation\Node.html
?????文件???????1920??2009-01-02?13:54??停車場模擬管理程序\src\edu\cqit\ParkSimulation\edu\cqit\ParkSimulation\package-fr
?????文件???????7951??2009-01-02?13:54??停車場模擬管理程序\src\edu\cqit\ParkSimulation\edu\cqit\ParkSimulation\package-summary.html
?????文件???????7827??2009-01-02?13:54??停車場模擬管理程序\src\edu\cqit\ParkSimulation\edu\cqit\ParkSimulation\package-tree.html
?????文件??????29430??2009-01-02?13:54??停車場模擬管理程序\src\edu\cqit\ParkSimulation\edu\cqit\ParkSimulation\ParkSimulation.html
?????文件??????11477??2009-01-02?13:54??停車場模擬管理程序\src\edu\cqit\ParkSimulation\edu\cqit\ParkSimulation\Queue.html
?????文件??????14220??2009-01-02?13:54??停車場模擬管理程序\src\edu\cqit\ParkSimulation\edu\cqit\ParkSimulation\Stack.html
?????文件??????25833??2009-01-02?13:54??停車場模擬管理程序\src\edu\cqit\ParkSimulation\edu\cqit\ParkSimulation\StopPanel.html
?????文件???????7455??2009-01-02?13:54??停車場模擬管理程序\src\edu\cqit\ParkSimulation\help-doc.html
?????文件???????1035??2008-12-28?14:21??停車場模擬管理程序\src\edu\cqit\ParkSimulation\ImageButton.java
?????文件??????54650??2009-01-02?13:54??停車場模擬管理程序\src\edu\cqit\ParkSimulation\index-all.html
?????文件???????1223??2009-01-02?13:54??停車場模擬管理程序\src\edu\cqit\ParkSimulation\index.html
?????文件???????2823??2008-12-31?11:15??停車場模擬管理程序\src\edu\cqit\ParkSimulation\li
?????文件???????1254??2008-12-31?10:39??停車場模擬管理程序\src\edu\cqit\ParkSimulation\MessagePanel.java
?????文件???????2007??2008-12-28?00:20??停車場模擬管理程序\src\edu\cqit\ParkSimulation\Node.java
?????文件???????7616??2009-01-02?13:54??停車場模擬管理程序\src\edu\cqit\ParkSimulation\overview-tree.html
?????文件?????????25??2009-01-02?13:54??停車場模擬管理程序\src\edu\cqit\ParkSimulation\package-list
............此處省略20個(gè)文件信息
評論
共有 條評論