freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

停車場管理-數(shù)據(jù)結(jié)構(gòu)課程設(shè)計報告-資料下載頁

2025-01-20 22:05本頁面

【導讀】設(shè)停車場T只有一個可停放幾輛汽車的狹長通道S1,且只有一個大門可供汽車進出。待該輛車開出大門后,為它讓路的車輛再按原次序進入車場。在這里假設(shè)汽車不能從便道上開。試設(shè)計一個停車場管理程序?,F(xiàn)在通道內(nèi)的汽車,將車牌號保存在汽車類中的車牌號屬性中。所以會遵循后進先出的原則)。方稱為車輛規(guī)避所。定了一個范圍,如果產(chǎn)生的隨機數(shù)落入到這個范圍內(nèi),則表示該汽車準備進入停車場,此時,汽車現(xiàn)進入通道內(nèi),如果通道內(nèi)已有汽車等待,則此汽車也排在后邊等待,如果它前面沒有汽車,這時檢查停車場內(nèi)是否有空車位,當有汽車離開后,檢查通道內(nèi)是否有汽車,如果有,則可以進入停車場停車。

  

【正文】 = stopCapacity。 initBuffer()。 initPavement()。 initStopping()。 init()。 display()。 setResizable(false)。 setSize(700, 500)。 setDefaultCloseOperation(EXIT_ON_CLOSE)。 } /** * 測試停車場是否已滿。 * * @return true 如果停車場已滿,否則返回 false。 */ public boolean isStopFull() { return (())。 } /* * 初始化停車場。 */ private void initStopping() { stopping = new StackCar(STOPPING_CAPACITY)。 } /* * 初始化緩沖區(qū)。 */ private void initBuffer() { buffer = new StackCar(STOPPING_CAPACITY)。 } /* * 初始化便道。 */ private void initPavement() { pavement = new LinkedQueueCar()。 } /** * 有車牌號為 carLicense 的汽車進入。 * * @param carLicense * 要進入停車場的汽車車牌號 */ public void carCome(String carLicense) { Car newCar = new Car(carLicense, )。 (newCar)。 (***********************************************\n)。 (牌照為 + carLicense + 的汽車進入便道 ...\n)。 if (pavePos STOPPING_CAPACITY) { paveBtns[pavePos].setState(, carLicense)。 pavePos++。 updateStopPanel()。 } waitting(WAIT_TIME)。 if (!isStopFull()) { (停車場有空位 ...\n)。 waitting(WAIT_TIME)。 pavementToStop()。 paveRet()。 } (***********************************************\n)。 } /* * 線程暫停 */ private void waitting(long timeout) { try { (timeout)。 } catch (InterruptedException e) { ()。 } } /** * 指定位置的汽車離開停車場。 * * @param pos * 準備離開的汽車所在停車場中的位置 */ public void carLeave(int pos) { if (pos STOPPING_CAPACITY || pos 0) { throw new NullPointerException()。 } (***********************************************\n)。 final int LEAVE_POS = pos。 final int STOP_LAST_POS = stopPos 1。 for (int i = STOP_LAST_POS。 i LEAVE_POS。 i) { stopToBuffer()。 } Car leaveCar = ()。 (牌照為 + () + 的汽車從停車場開走 ...\n)。 stopBtns[LEAVE_POS].setState(, + (pos + 1))。 stopPos。 updateStopPanel()。 waitting(WAIT_TIME)。 for (int i = LEAVE_POS。 i STOP_LAST_POS。 i++) { BufferToStop()。 } if (!()) { (便道中有汽車要進入停車場 ...\n)。 waitting(WAIT_TIME)。 pavementToStop()。 paveRet()。 } (***********************************************\n)。 } /** * 停車場中的汽車暫時開入緩沖區(qū)。 */ public void stopToBuffer() { try { Car aCar = ()。 (aCar)。 (牌照為 + () + 的汽車暫時退出停車位 ...\n)。 stopBtns[stopPos 1].setState(, + stopPos)。 stopPos。 updateStopPanel()。 waitting(WAIT_TIME)。 } catch (Exception e) { ()。 } } /** * 緩沖區(qū)的汽車開回停車場。 */ public void BufferToStop() { try { final int NEXT_STOP_POS = stopPos。 Car aCar = ()。 (aCar)。 (牌照為 + () + 的汽車停回停車場的 + (stopPos + 1) + 車位 ...\n)。 stopBtns[NEXT_STOP_POS].setState(, aCar .getLicensePlate())。 stopPos++。 updateStopPanel()。 waitting(WAIT_TIME)。 } catch (Exception e) { ()。 } } /** * 便道中的汽車開入停車場。 */ public void pavementToStop() { final int PAVE_FIRST_POS = 0。 Car aCar = ()。 try { (aCar)。 } catch (Exception e) { ()。 } (牌照為 + () + 的汽車從便道上進入停車位的 + (stopPos + 1) + 車位 ...\n)。 paveBtns[PAVE_FIRST_POS].setState(, empty)。 pavePos。 stopBtns[stopPos].setText(())。 stopBtns[stopPos].setState(, ())。 stopPos++。 updateStopPanel()。 waitting(WAIT_TIME)。 } /** * 更新便道中的汽車所在位置。 */ public void paveRet() { final int PAVE_LAST_POS = pavePos。 ImageButton currentBtn。 ImageButton priorBtn。 for (int i = 0。 i PAVE_LAST_POS。 i++) { currentBtn = paveBtns[i]。 priorBtn = paveBtns[i + 1]。 (, ())。 (, empty)。 updateStopPanel()。 waitting(500)。 } if (() = STOPPING_CAPACITY) { Car car = (PAVE_LAST_POS + 1)。 if (car != null) { pavePos++。 currentBtn = paveBtns[PAVE_LAST_POS]。 (, ())。 updateStopPanel()。 } } } /** * 更新顯示界面。 */ public void updateStopPanel() { ()。 ()。 } /** * 通過隨機產(chǎn)生車牌號和車位號,用來模擬發(fā)出汽車到達和離開的信息 */ // TODO 修改 2 public void random() { Random random = new Random()。 for (int i = 0。 i 20。 i++) { try { int e = (100000) + 1。 (第 + (i + 1) + 次準備進入的車牌號為: + e)。 if (e 10000 amp。amp。 e 100000) carCome(e + )。 waitting(WAIT_TIME)。 int leave = (15) + 1。 (第 + (i + 1) + 次準備出去的車的停車位是: + leave)。 if (leave 0 amp。amp。 leave = 10) { if (leave=stopPos){ leaveCarPos = leave。 carLeave(leaveCarPos1)。 leaveCarPos = 1。 waitting(WAIT_TIME)。 } } (4000)。 } catch (InterruptedException e) { ()。 } } } } ( 11)主方法類 package 。 public class Main { public static void main(String[] args) throws Exception { new BeginFrame()。 } }
點擊復(fù)制文檔內(nèi)容
高考資料相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1