Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need assistance formulating this program. Here is the program. here is the example output. Thank you 2425337.pdf Q ; CSC 212 Principles of Programming

image text in transcribed

I need assistance formulating this program. Here is the program.

image text in transcribed

image text in transcribed

here is the example output. Thank you

2425337.pdf Q ; CSC 212 Principles of Programming Homework Assignment 6 Write a Java program that manages seating for an airplane. The program first asks the user for a flight number, number of rows, and the number of seats per row. Then, the program presents the user with a list of commands that can add a passenger, remove a passenger, display the current seat assignments, and print a passengerstor a given plane. The example below shows the interaction Design Make sure that your program uses a Java package called 'csc212hw06. Your program should consist of the following classes Mair Read input from the user to get information about the plane Process commands as shown in the example . Plane This should contain a private multi-dimensional array of Passenger objects Write a constructor that accepts the following parameters: String for the flight number an integer for the number of rows, and an integer for the number of seats per row. Write the following public methods . . . o addPassenger accepts parameters: String for passenger name, integer for row, and an integer for the seat within the row. The method should make sure the requested seat is valid and empty, then create a Passenger object and assign it to the seat. Returns a boolean value based on whether the passenger was added o removePassenger accepts parameters: integer for the row, and integer for the seat. The method checks that the requested seat is valid and not empty?then assigns null to that seat. Retuns a boolean value indicating if the remove was successful o showseats) Displays a grid showing all rows and seats, and each passenger assigned. Columns for names should be 10 characters wide (see example session). o passengerlist Displays a list of passengers showing their name, and their fare (see example session). Passenger . Should have the following private variables o String name o double fare A constructor method that accepts a String parameter to initialize the name. It also generates a random double between 100 and 500 and initializes the fare . A getName method that retums the name of the passenger . AtoString) method that returns aString containing all the variables with a label (as shown in the example session)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Information Quality Dimensions, Principles And Techniques

Authors: Carlo Batini, Monica Scannapieco

1st Edition

3319241060, 9783319241067

More Books

Students also viewed these Databases questions