Program should assign a seat in the first class

Assignment Help JAVA Programming
Reference no: EM13162683

You are to write a program to assign seats on each flight for an airline's only flight with a capacity of 80 seats (20 rows, and 4 columns).
Your program should display the following menu:
Enter 1 for first class, 2 for business class, 3 for economy class, 4 to display the available seats, and 5 to quit:
If a person enters 1, your program should assign a seat in the first class (rows 1 - 3). If a person enters 2, your program should assign a seat in business class (rows 4 - 7). If a person enters 3, your program should assign a seat in economy class (rows 8 - 20). If the seat is available at the given class, then the program should issue a boarding pass with the row and column number, and class type. If a customer asks for a class that is already full, then your program should ask the customer if it is okay to assign a seat in one of the other classes. If the flight is full, the program should print the message "This Flight is Full, Next Flight leaves in Three Hours".
Use a two dimensional array to represent the seating chart of the plane. Initialize all the elements of the array to 0 to indicate that all seats are empty. As each seat is assigned, set the corresponding element of the array to 1 to indicate that the seat is no longer available.
Your program should of course never assign a seat that has already been assigned.
You are required to write this program using functions. The prototype of your functions may look like as below or you may define them in any other way that you wish :
void MakeFirstClassReservation(int a[][4] );
void MakeBusinessClassReservation(int a[][4] );
void MakeEconomyClassReservation(int a[][4] );
bool IsFirstClassFull(int a[][4] );
bool IsBusinessClassFull(int a[][4] );
bool IsEconomyClassFull(int a[][4] );
void DisplayArray( int a[][4]);
etc.
If you define proper functions and use them in your main program, then your main program should not be complicated, and it will consist of small number of manageable statements.

Reference no: EM13162683

Questions Cloud

Required value for the move command : Shape_index is a required value for the move command. It is the index of the shape in the shape data arrays that you wish to move. It should range between 0 and MAX_SHAPES - 1. Be sure to validate the index.
Write a function that takes a list of integers as argument : Write a function that takes a list of integers as argument and returns a pair consisting of the sum of the even positions and the sum of the odd positions of the list. You should not use any auxiliary functions.
Receiver decide which symbol was originally sent : How can a receiver decide which symbol was originally sent when a received "point" lies somewhere in between other points in the diagram?
Program to translates a number into the closest letter grade : Write a program that translates a number into the closest letter grade. For example, the number 2.8 (which might have been the average of several grades) would be converted to B-. Break ties in favor of the better grade
Program should assign a seat in the first class : If a person enters 1, your program should assign a seat in the first class (rows 1 - 3). If a person enters 2, your program should assign a seat in business class (rows 4 - 7). If a person enters 3, your program should assign a seat in economy class ..
Write a version of sumpairs : Write a version of sumPairs  that sums each component of the pairs separately, returning a pair consisting of the sum of the first components and the sum of the second components. So basically [(3,1)(10,3)] would return (13,4).
The program reads in names : Write a program and include the following methods. The program reads in names and ages (use 2 parallel arrays, maximum size 50) from a file called Stuff.dat.
Design an adt for a two-color : Design an ADT for a two-color, double-stack ADT that consists of two stacks one "red" and one "blue" and has as its operations color-coded versions of the regular stack ADT operations.
How many moles of h2so4 must be present to react completely : How many moles of H2SO4 must be present to react completely with the NaOH delivered from the buret.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Robot preparing for competition

Create an event so that the skateboard can be controlled by game player

  Develop class which implements interface

Let the ADT called SquareMatrix. (The matrix can be represented by 2-D array of ints w/ n rows and n columns.) Write specification for ADT as Java interface. Develop the class which implements interface.

  Create a java program to calculate the circumference

Create a Java program based on the geometric shapes. The program should begin by prompting you for the shape you want to calculate the circumference.

  Algorithm analysis with advanced data structures

Write a program to help the merchants devise a sequence of transmutations that would change silver into gold with the smallest possible total fee paid to the alchemists.

  Implement a card game in java

In this assignment, you will be asked to implement a card game. You will need to make several design decisions for your code. It will be expected that all classes you write will utilize the principle of encapsulation.

  Ask the user how many times you want to run

c the algorithm. 2. Then choose a word at random from the array of Strings as the target (Use the integer random number generator)

  Technical community blog

Write a blog article for a coding/technical community blog

  Write a java program called salesinfominer

Write a Java program called SalesInfoMiner that reads in a file of products, stored in text format. The program must then read in information about past sales transactions and output all the products to a new file, sorted by product description,..

  Java program to create a tree

Java program to create a tree, generate class - BottomUpTwoThreeFourTree, BottomUpTwoThreeFourTree,

  Elements from a html document

Function test Count List Elements should simply retrieve an array of all list elements on the page and assert that their total count is 3.

  Implement a shopping cart class with user interface

project will be to implement a shopping cart class with user interface (UI) that contains main() in Net Beans. The UI class will be used to perform user input/output and to invoke the appropriate methods of shopping cart class. When your program star..

  Picky publishing house publishes stories

Picky Publishing House publishes stories in three categories and has strict require- ments for page counts in each category. Create an abstract class named Story that includes a story title, an author name, a number of pages, and a String message. In..

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