GithubHelp home page GithubHelp logo

xiunhon / assign-airplane-seats-java Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 16 KB

Practice designing proper classes without using Scanner or PrintStream outside of class main.

Java 100.00%
passengers seats aisle window center travelclass java enum airplane map

assign-airplane-seats-java's Introduction

Airplane Seats Assignment

Write a program that assigns seats on an airplane. Assume the airplane has 20 seats in first class (5 rows of 4 seats each, separated by an aisle) and 90 seats in economy class (15 rows of 6 seats each, separated by an aisle). Your program should take three commands: add passengers, show seating, and quit. When passengers are added, ask for the class (first or economy), the number of passengers traveling together (1 or 2 in first class; 1 to 3 in economy), and the seating preference (aisle or window in first class; aisle, center, or window in economy). Then try to find a match and assign the seats. If no match exists, print a message. Print an error message if the user enters an incorrect value. Allow the user to re-enter a value if an incorrect value was entered. Your solution should include a class Airplane that is not coupled with the Scanner or PrintStream classes. Sample Output A)dd S)how Q)uit s 1:. . . . 2:. . . . 3:. . . . 4:. . . . 5:. . . . 6:... ... 7:... ... 8:... ... 9:... ... 10:... ... 11:... ... 12:... ... 13:... ... 14:... ... 15:... ... 16:... ... 17:... ... 18:... ... 19:... ... 20:... ... A)dd S)how Q)uit a F)irst E)conomy f Passengers? (1-2) 1 A)isle W)indow a

A)dd S)how Q)uit a F)irst E)conomy f Passengers? (1-2) 2

A)dd S)how Q)uit a F)irst E)conomy e Passengers? (1-3) 1 A)isle C)enter W)indow a A)dd S)how Q)uit a F)irst E)conomy e Passengers? (1-3) 2 A)isle C)enter W)indow c A)dd S)how Q)uit a F)irst E)conomy e Passengers? (1-3) 3 A)dd S)how Q)uit s 1:. * * * 2:. . . . 3:. . . . 4:. . . . 5:. . . . 6:*** *** 7:... ... 8:... ... 9:... ... 10:... ... 11:... ... 12:... ... 13:... ... 14:... ... 15:... ... 16:... ... 17:... ... 18:... ... 19:... ... 20:... ... A)dd S)how Q)uit q Press any key to continue . . .

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.