Create a programming system, C/C++ Programming

Your task is to create a programming system for a ferry. The ferry transports passengers and vehicles (cars, busses, lorries and bicycles). The ferry has space for 200 passengers and 40 cars. A lorry need as much space as two busses or 8 cars. A car need as much space as 5 bicycles. There are di erent fees for di erent vehicles and an extra fee might be added for passengers. Use the following fees:

 Passenger without vehicle, 20 kr.
 Bicycle 40 kr (passenger included).
 Car 100 kr + 15 kr/passenger. (maximum 4 passengers)
 Bus 200 kr + 10 kr/ passenger. (maximum 20 passengers)
 Lorry 300 kr + 15 kr/ passenger. (maximum 2 passengers)

Every type of vehicle (car, bus, lorry, bicycle) will inherit from the class Vehicle. The functionality of the ferry is given by the interface Ferry :

public interface Ferry {
int countPassengers(); // Number of passengers on board
int countVehicleSpace(); // Used vehicle space. One car is 1.
int countMoney(); // Earned money
Iterator iterator(); // Vehicle iterator
void embark(Vehicle v); // Embark vehicle, warning if not enough space
void embark(Passenger p); // Embark passenger, warning if not enough room
void disembark(); // Clear (empty) ferry. The money earned remains,
// i.e., is not reset to zero
boolean hasSpaceFor(Vehicle v); // true if we can embark vehicle v
boolean hasRoomForPassenger(); // true if we can embark another passenger
String toString(); // Nice looking ferry status print out

A vehicle can not leave the ferry until the ferry has been disembarked and the same vehicle can not embark twice. The ferry iterator should iterate over all vehicles embarked (not the passengers). Also write a test program, embarking a number of vehicles and passengers, showing the functionality of the methods.

Posted Date: 3/14/2013 5:53:59 AM | Location : United States

Related Discussions:- Create a programming system, Assignment Help, Ask Question on Create a programming system, Get Answer, Expert's Help, Create a programming system Discussions

Write discussion on Create a programming system
Your posts are moderated
Related Questions
write a program that counts the number of occurences of the string in the n-th Padovan string P(n) program in java // aakash , suraj , prem sasi kumar kamaraj college progr

1.1 A Few Notes: 1. Please test your program with various inputs prior to submission. 2. All group members must understand the entire project for interactive grading. Equal

Pointers are just numbers, representing addresses in memory. You can add to and subtract from pointers, for instance. It is pretty easy to make mistakes with pointer math, however,

there is a pebble merchant. he sells the pebbles,that are used for shining the floor.his main duty is to take the length of the room side but he sometines mistakes doing that and m

Precautions with function overloading Function overloading is a boon to designers, since dissimilar names for same functions need not be thought of, which often is a cumbersome

What is copy constructor? describe the concept of copy constructor.

(a) Write a fragment of code that declares a variable colSp of type ColourSpot, and then moves it to the point (3, -4), and sets its colour to Green. (b) A function QU8 is speci

Based on the automobile's model year and weight, the city of Cebu determines the car's weight class and registration fee using the following schedule: Model Year Registration

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b