1. Write a program in Java to allow a user select a seat on the passenger airjet. The program should have the following structure:
a) Object A should provide the list of seats and their pricing to the user.
b) Object B should allow the user to choose a seat from the list of available seats. c) Object C should display the total cost of the seat choosen by the user.
2. Modify the above program to use an interface having variables that will be used to determine the pricing on every seat available on the airjet.
3. Modify the program written for question 2 to implement inheritance in providing the list of available seats to the user.
4. Using a snippet explain how common coupling can be avoided in writing this program.
5. Using a snippet explain how utility cohesion can be implemented in writing this program.Attachments
Attached is the solution including source, comments, and answers to the questions. The instructions were quite vague, but I believe the goal of the assignment was accomplished. Let me know if you have any questions.
was factored into the base class.
Since the base class contained the pricing for the aisle seat and knew nothing about first class, when the first class seat needed pricing
information it could expand upon
//prompt user for choice
System.out.print("Which seat would you like (1-5): ");
int choice = input.nextInt();
Seat seat = seats[choice - 1];
System.out.println("The seat price is: $" + seat.getPrice());