473,387 Members | 3,684 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Errors with Ferry Application

1
Hello;

I am beginner in java and I should submit one java program in early day.
I try to write this program more then ten time but every time I find one broblem.
Please help me because if you don't do that I am sure that I can not finish that before submited date.
I write my assignment here also I write my codes please help me and guide me with writting the enough describe.
thnaks for your help.








package javaapplication1;

/**
*
FERRY TICKETING SYSTEM

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”.

*/
import java.util.Scanner;

public class Main {

/** Creates a new instance of Main */

/**
* @param args the command line arguments
*/
private static Scanner ref=new Scanner(System.in);
String Enterence;

public static void main(String[] args) {
// TODO code application logic here

MMenu();
Select(Enterence);
}

private static void MMenu()
{

int MAX =3;

String[] submenu = new String[MAX];

submenu[0] = new String("TO Purchase Ticket \t\t\t[Press --P-- button ]");
submenu[1] = new String("To View Seating Arrangement\t\t[Press --V-- button ]");
submenu[2]= new String("To Quit The System\t\t\t[Press --Q-- button ]");

for (int i = 0; i < MAX; i++) {
System.out.println(" - " + submenu[i]);
}

Enterence=ref.nextLine();
}


private static void Select(String Select) {

if (Select.equals("P")||Select.equals("p")){
SubMenu();
SelectSubmenu();}
else
if (Select.equals("V")|| Select.equals("v"))
System.out.println("okey");
else
if (Select.equals("Q")|| Select.equals("q"))
System.out.println("Do you want to exit from the software(Y/N)? ");
else
System.out.println("ONLY press |P***V***Q|button");

}

private static void Exit()
{
System.exit(-1);
}

private static void YesNo(String YesNo)
{
Scanner refer=new Scanner(System.in);
String yes=refer.nextLine();
if(YesNo.equals("y")||YesNo.equals("Y"))
Exit();
else if (YesNo.equals("n")||YesNo.equals("N"))

MMenu();
}
private static void SubMenu()
{
int MAX1 =3;

String[] submenu1 = new String[MAX1];

submenu1[0] = new String("Purchase Ticket For Business class\t[Press --B-- Button ]");
submenu1[1] = new String("Purchase Ticket For Economy class\t[Press --E-- button ]");
submenu1[2]= new String("Return to main menu\t\t\t[Press --M-- button ]");

for (int i = 0; i < MAX; i++)
System.out.println(" - " + submenu[i]);
}

private static void SelectSubMenu(String SelectSubMenu)
{
if (SelectSubMenu.equals("b")||SelectSubMenu.equals(" B"))
TimeTable();
else
if(SelectSubMenu.equals("e")||SelectSubMenu.equals ("E"))
TimeTable();
else
if (SelectSubMenu.equals("m")||SelectSubMenu.equals(" M"))
System.out.println("return return return");
else
System.out.println("ONLY press |B***E***M|button");

}
private static void TimeTable()
{
System.out.println("Time Table :\n\n10:00\n11:00\n12:00\n13:00\n14:00\n15:00\n16: 00\n17:00\n");
System.out.println("\nPlease select your suitable time movement : ");

set_time = ref.next();
SelectFerry();
}

private static void SelectFerry(String SelectFerry)
{

}
}
Apr 11 '08 #1
2 2327
epots9
1,351 Expert 1GB
Moved to the JAVA Forums, where the resident experts can better assist you, and remember they won't give you the answer to your homework question, but giving the details you've provided they can help point you in the right direction.

**Moved from Programming Challenges
Apr 11 '08 #2
pronerd
392 Expert 256MB
Forums are generally setup to assist with specific problems and questions. They are not here to write your code for you, much less to do your homework for you.
Apr 11 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Douglas Buchanan | last post by:
I am using the following code instead of a very lengthly select case statement. (I have a lot of lookup tables in a settings form that are selected from a ListBox. The data adapters are given a...
6
by: Shabam | last post by:
A web application of mine developed using C# + MS SQL runs fine normally. However when I stress test it with a load testing software (using about 60 simultaneous users) some instances start...
12
by: Russ | last post by:
Hello. My new dev machine is running XP Pro. In the past all equipment has only used Windows 2000. I have had a lot of problems getting my projects up and running on the new machine. The current...
1
by: Ersin Gençtürk | last post by:
We couldn't find why these errors happen.They doesn't appear everytime.And they appear different pages at different times.Is there somebody know why these happenes ? First user gets this error :...
2
by: Marty McDonald | last post by:
Many of our apps are in production and they do not have proper error logging in them - unhandled errors are seen by the users in the form of error messages and stack traces. I know how to make...
1
by: Srini | last post by:
Hi, What is the best method to share the application defined errors in C# ASP.NET application. Basically I would like to have all the errors defined in one place and share those between modules...
10
by: dbuchanan | last post by:
Hello, >From time to time my vb2005 form disappears and is replaced by the following errors. Rebuilding the application never helps. However the errors never affects the operation of my...
11
by: Howard Kaikow | last post by:
I'm using the code below, but an error is not getting trapped. Where can such errors occur? In another process? Try SomeCode Catch ex As Exception Dim strMsg() As String = Split(ex.ToString,...
25
by: JJ | last post by:
I only want to catch 404 errors at the application level (the rest are will be handled by the customerrors section of the web.config). How do I check for the error code in the Application_Error...
2
by: pssraju | last post by:
Hi, At present application was built on solaris 9 using sun studio 9 (Sun C++ 5.6) & rouguewave sorce pro 5. We are planning to port the same application onto SuSE Linux 9.5.0 using GCC 3.3.3 & RW...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.