CSC-113-Lab.12 - + Vehicule (String, boolean) +...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
KSU / CCIS / CS DEPARTMENT CSC-113, SPRING 2010 LAB 12 – LINKED LISTS Translate the following UML classes into Java. Class Vehicle : isSimilar(v:Vehicle): boolean For cars, returns true if the vehicle has the same number of cylinders. For buses, returns true if the vehicle has the same number of seats. 1 First List - name: String + List(s: String) + size(): int + insertAtFront(d: Vehicle) + getElement(i:int): Vehicle + remove():List + displaySimilars(obj: Vehicle) Node - data: Vehicle - next: Node + Node(d: Vehicle) + Node(n: Node) + setNext(n: Node) + getNext(): Node + getData(): Vehicle suB - nbSeats: int + Bus (String, boolean, int) + Bus (Bus) raC - nbCylinders: int + Car (String, boolean, int) Vehicle # name: String # available: boolean
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: + Vehicule (String, boolean) + isSimilar(v:Vehicle):boolean Class List:-displaySimilars(obj: Vehicle) display all the elements similar to obj.-remove():List returns the list of elements removed based on the condition of the deletion. Bus Station :-addBus(b: Bus) : adds a bus.-removeNotAvailable():List returns the list of vehicles removed that are not available to be used -countSimilarBus(b: Bus): int returns the number of buses that have the same number of seats. 1 List- name: String + List(s: String) + size(): int + insertAtFront(d: Vehicle) + getElement(i:int): Vehicle + remove():int LV BusStation-name: String + BusStation (n1: String, n2: String) + addBus (b: Bus) +removeNotAvaible():List + countSimilarBus( b: Bus): int...
View Full Document

This note was uploaded on 11/28/2011 for the course COMPUTER S 113 taught by Professor Dr.safwanqasem during the Spring '11 term at King Saud University.

Page1 / 2

CSC-113-Lab.12 - + Vehicule (String, boolean) +...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online