A small ferry company has just purchased a computer for its new automated ticketing system. The company director has asked you to design the new system to assign seats for each trip of the 50-seater ferry, which covers the route from Penang to Langkawi and back daily. The upper deck of the ferry is reserved for business class passengers and can accommodate 10 people. The main deck of the ferry, the economy class can accommodate 40 people. Assume the company has at least 8 ferries - each with a different Ferry ID, which travel at one-hour intervals from 10 am to 5 pm daily.

SECTION A : BASIC REQUIREMENTS OF THE SYSTEM

1. Main Menu
Your initial program design should display the following menu alternatives:

FERRY TICKETING SYSTEM
P – to Purchase Ticket
V –to View Seating Arrangement
Q – to Quit the system

2. Submenu
The following submenu will be displayed when P is selected:

PURCHASING MODULE
B – to purchase ticket for Business class
E – to purchase ticket for Economy class
M – to return to Main Menu

3. Assigning Seats
If the person types B, then your program should assign a seat in the business class (seats 1-10). If the person types E, then your program should assign a seat in the economy class (seats 11 - 50).

4. Boarding Ticket
Your program should then print a boarding ticket indicating the person’s name, seat number, whether it is in the business or economy class of the ferry, date and time of departure, departure point and destination of the trip and Ferry ID.


5. Seating Chart
Use a single-scripted array to represent the seating chart of the ferry, indicating the availability of the seats within each trip of the ferry. Initialize all the elements of the array to 0 to indicate that all seats are empty. As each seat is assigned, set the corresponding elements of the array to 1 to indicate that the seat is no longer available. Your program should never assign a seat that has already been assigned.

The Ferry ID will be requested when V is selected from the main menu and the seating arrangement for that ferry will be displayed in a tabular form, e.g.

*************************************************************
* Ferry ID : 007 Date: 19 Sept 2005 *
*************************************************************
* BUSINESS CLASS *
*************************************************************
* 1 * 1 * 1 * 0 * 0 *
*************************************************************
* 0 * 0 * 0 * 0 * 0 *
*************************************************************
* ECONOMY CLASS *
*************************************************************
* 1 * 1 * 1 * 1 * 1 *
*************************************************************
* 1 * 1 * 1 * 1 * 1 *
*************************************************************
* 0 * 0 * 0 * 0 * 0 *
*************************************************************
* 0 * 0 * 0 * 0 * 0 *
*************************************************************
* 0 * 0 * 0 * 0 * 0 *
*************************************************************
* 0 * 0 * 0 * 0 * 0 *
*************************************************************
* 0 * 0 * 0 * 0 * 0 *
*************************************************************
* 0 * 0 * 0 * 0 * 0 *
*************************************************************

6. Alternative seating
When the business class is full, your program should ask the person if it is acceptable to be placed in the economy class (and vice versa). If yes, then make the appropriate seat assignment. If no, then print the message “Next trip leaves in 1 hour”.

Hi bmbvm5 and welcome to DaniWeb,

Unfortunately we are not allowed to just do the work for you, we need to see some effort and then we can give pointers. What have you done so far? What problems are you having? Just giving us your assignment specification isn't enough sorry.

Hello,
may you please send me sample of exercises which help me to do that.
I have many problem for doing that.
thank you

SECTION A : BASIC REQUIREMENTS OF THE SYSTEM

1. Main Menu
Your initial program design should display the following menu alternatives:

FERRY TICKETING SYSTEM
P – to Purchase Ticket
V –to View Seating Arrangement
Q – to Quit the system

2. Submenu
The following submenu will be displayed when P is selected:

PURCHASING MODULE
B – to purchase ticket for Business class
E – to purchase ticket for Economy class
M – to return to Main Menu

It would be easiest to use a switch statement for you menu's link below explains switch statements.
Switch Statements
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/switch.html

5. Seating Chart
Use a single-scripted array to represent the seating chart of the ferry, indicating the availability of the seats within each trip of the ferry. Initialize all the elements of the array to 0 to indicate that all seats are empty. As each seat is assigned, set the corresponding elements of the array to 1 to indicate that the seat is no longer available. Your program should never assign a seat that has already been assigned.

The Ferry ID will be requested when V is selected from the main menu and the seating arrangement for that ferry will be displayed in a tabular form, e.g.

Here is some information about arrays in Java to get you started with this part you will most likely need to use a 2d array
Arrays
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arrays.html

you would probably have to use if statements to check if the seat is already taken
Using If Statements
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/if.html

a Nested for loop is the best way that i can think of to display a 2d array
Information on For Loops
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/for.html
Information on For Loops Inc Nested Loops
http://www.javacoffeebreak.com/books/extracts/javanotesv3/c3/s4.html

Make an Attempt at writing the program, and then ask for help if your still stuck but you need to show us that you've made some attempt, we cant just write code for you.

goodluck with your program

-Matt

First create a class Ferry with the necessary attributes and method for adding passengers. Use the assignment's specifications in order to find out what methods you should have and they should do.

help help....i cant use my codes....dono how to wirte do while....

help help....i cant use my codes....dono how to wirte do while....

Start a new thread and post some code

its the same question.... and i did some of it....n i dono how to make the menu apeare wen ppl enter wrong selection....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.