有没有懂JAVA语言数据结构的高手?救命啊~~~

来源:百度知道 编辑:UC知道 时间:2024/06/05 04:51:50
设计一个停车场管理系统
任务:通过此系统可以实现如下功能:
自己设定数据结构描述停车位的情况
查询:
可以查询车位的情况(如,车位是否满、不满的话几号位可以停车等信息);
泊车:
指示在几号位停车,并修改相应标识表示该车位已占用
取车:
指示开走几号位的车,并修改相应标识表示该车位已空

<数据结构与java集合框架>第二版中就有
自己可以查!

当然为了分在麻烦也要写:
//Queue.java
import java.util.*;

public class Queue {

protected LinkedList list;

// Postcondition: this Queue object has been initialized.
public Queue() {

list = new LinkedList();

} // default constructor

// Postcondition: the number of elements in this Queue object has been
// returned.
public int size() {

return list.size();

} // method size

// Postcondition: true has been returned if this Queue object has no
// elements. Otherwise, false has been returned.
public boolean isEmpty() {

return list.isEmpty();

} // method isEmpty

// Postconditon: A copy of element has been inserted at the back of this
// Queue object. The averageTime (n) is constant and
// worstTime (n) is O (n).
public void enqueue(Object element) {