Create a programming system, C/C++ Programming

Assignment Help:

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 FerryMain.java, embarking a number of vehicles and passengers, showing the functionality of the methods.


Related Discussions:- Create a programming system

Answer, what is spanning tree? explain prims algorithm spanning tree?

what is spanning tree? explain prims algorithm spanning tree?

What difficulty does the namespace feature solve out?, A: Multiple provider...

A: Multiple providers of libraries might employ common global identifiers causing a name collision whereas an application attempt to link with two or more such libraries. The names

Prob, Given an integer n and a permutation of numbers 1, 2 ... , n-1, n wri...

Given an integer n and a permutation of numbers 1, 2 ... , n-1, n write a program to print the permutation that lexicographically precedes the given input permutation. If the given

Get linux caller id to work with usb modem on ubuntu, Project Description: ...

Project Description: I am seeking someone who can make this modem work with Linux Caller ID on Ubuntu present stable version. Skills required are C Programming, Python

C program for maximum no, C Program for MAXIMUM NO, MINIMUM NO AND SORTING ...

C Program for MAXIMUM NO, MINIMUM NO AND SORTING   void main() {           int i,j,t;           int a[5];           clrscr();           for(i=0;i

Areaunder curve, Write a program to find the area under the curve y = f(x) ...

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

Define polymorphism?, Define Polymorphism? A: Polymorphism let a client ...

Define Polymorphism? A: Polymorphism let a client to treat di_erent objects in the simialr way even if they were developed from di_erent classes and exhibit di_erent behaviors.

Luminous jewel - a polishing game, Byteland county is very famous for lumin...

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

How many levels deep can include files be nested, How many levels deep can ...

How many levels deep can include files be nested? - As such, there is no limit to number of levels of nested include files you can have however your compiler might run out of s

Programming, write a program that can accept numbers and perform all the fo...

write a program that can accept numbers and perform all the four arithmetic operation

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd