您的位置:寻梦网首页编程乐园Java天地Core JavaJava Lecture Notes

Introduction

Content

Apply

Reflect

Extend

previous.gif
 (3087 bytes)

next.gif
 (2959 bytes)


Extend Index

Extend Page # 14

Additional Activity 1

(Airline Reservations System) A small airline has just purchased a computer for its new automated reservations system. You have been asked to program the new system. You are to write a program to assign seats on each flight of the airline抯 only plane (capacity 10 seats).

Your program should display the following menu of alternatives:
Please type 1 for 搒moking?br> Please type 2 for 搉on-smoking?br>
If the person types 1, your program should assign a set in the smoking section (seats 1-5). If the person types 2, you program should assign a seat in the non-smoking section (seats 6-10). Your program should then print a boarding pass indicating the person抯 seat number and whether it is in the smoking or non-smoking section of the plane.

Use a single dimensional array to represent the seating chart of the plane. Initialise all the elements of the array to 0 to indicate that the 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 of course, never assign a seat that has already been assigned. When the smoking section is full, your program should ask the person if it is acceptable to be placed in the non-smoking section (and vice versa). If yes, make the appropriate seat assignment. If no, print the message 揘ext flight leaves in 3 hours? (This is Exercise 7.18 p 308 , Chapter 7 of Deitel and Deitel)

Additional Activity 2

Complete exercise 10.9 p 506 Chapter 10 of Deitel and Deitel


Back to top

 basicline.gif (169 bytes)

RITSEC - Global Campus
Copyright ?1999 RITSEC- Middlesex University. All rights reserved.
webmaster@globalcampus.com.eg