QuestionQuestion

Transcribed TextTranscribed Text

Your task is to implement a solution to the problem described below. Your work needs to be submitted via CI Learn and must include the following: • Your version of all the files: o BusReservationClient.java – the client is provided and should not be changed o BusSeat.java o BusSeatBusinessClass.java o BusSeatEconomyClass.java o BusSeatPlan.java o takenBusSeats.txt • Output of your program • Must include your name in each file that you are submitting. You need to: o use Scanner – for the input and processing the data read from the file o use System.out.print, System.out.println, System.out.printf for output o implement classes and methods as suggested in the attached UML class diagram o include as many comments as are necessary to describe what the given code segment is doing IMPORTANT: • Your program output should match the output provided in the sample run below • Submit as much as you have done, even if the code is not working, by the due date. The late submissions will not be accepted and result in F for the project. • All submitted work must be done individually. • Your code must compile in order to be graded. • Each file must be formatted and must contain your name. • Have only one return statement per value returning method • Capture the output of your program and submit with the java files. • When finished, zip all the files together and submit the package for grading. Please do not remove //TODO comments from the code, but feel free to alter them for example: // TODO - done; // TODO – needs debugging; etc. BEFORE STARTING PLEASE READ THE PROBLEM DESCRIPTION AND THE INSTRUCTIONS CAREFULLY. Problem Description Write a program that assigns seats for a commercial bus. The bus has 25 rows, with 4 seats in each row. Rows 1 to 5 are business class; the remaining rows are economy class. The economy class seats can be upgraded on request to include a meal. The price of a business class ticket is $35.99; the price of an economy class ticket is $25.50. The upgraded economy class ticket costs 15% more than the reqular economy class ticket. When the program starts, the initial seat assignment is such that none of the seats are taken. Sales information is provided in a text file takenBusSeats.txt Each line in the text file represents the taken seat: • for the business type of tickets it is the row and the column of the seat that is taken. • for the economy class ticket it is the row and the column of the seat that is taken follow by true or false; where true indicates that the seat is UPGRADED and false indicates that the seat is REGULAR This information from the file must be applied to the seat assignments, by marking appropriate seats taken. After that the seating plan is displayed in the following format: A B C D == BUSINESS CLASS == Row 1 X X X X Row 2 X X X X Row 3 X X X * Row 4 X X X X Row 5 X X X X == ECONOMY CLASS == Row 6 U X U U Row 7 U U U U Row 8 X X * * Row 9 * * * X Row 10 U * * X Row 11 * * * * Row 12 X X U * Row 13 X * U * Row 14 * * * * Row 15 * * * * Row 16 * * * * Row 17 U * * U Row 18 * X X * Row 19 * * * * Row 20 * * * * Row 21 * * X * Row 22 * * X X Row 23 * * * * Row 24 * * * U Row 25 * * * * Here, * indicates that the seat is available; X indicates that the seat is taken; U indicates that the economy seat is taken and upgraded. The user is prompted for the section (BUSINESS or ECONOMY) in which he wants to buy a ticket in. The program finds the first available seat in the desired section. If the seat is in the ECONOMY section the user is given a choice to have the seat UPGRADED. If there is no room in the requested section the error is given. If the free seat was found, the ticket is printed, the seat is marked as taken and the user is shown the updated seat plan and asked if (s)he wants to make another reservation. After each run of the program, the current seat assignments are saved to the same file takenBusSeats.txt (please note that takenBusSeatsCOPY.txt file is also provided for your convenience, in case you want to restore the initial data during the testing). The client class BusReservationClient.java is fully implemented. You need to implement the following remaining classes: • BusSeat.java - abstract class to implement the seat objects, with two subclasses BusSeatBusinessClass.java and BusSeatEconomyClass.java o it has two abstract methods that must be implemented in each of the subclasses: printTicket (it displays the purchased ticket) toString (it constructs a String representation of the seat object) • BusSeatPlan.java – that is responsible for the seat manipulation o this.seats – ArrayList<BusSeat> holds all seat objects for the bus • constructors must utilize mutator methods • mutator methods must validate input and throw appropriate exception if the input is not valid Start with the attached UML diagram and draw a memory diagram depicting how data is organized. Next, finish skeletons for each class. Analyze the Sample Runs below to better understand the project’s algorithm and ensure that your program matches the sample run. UML Diagram: See below sample runs of the program: FIRST RUN (the user input is shown in green: ---> adding BusSeatBusinessClass objects to this.seats ---> adding BusSeatEconomyClass objects to this.seats ---> Processing data from "takenBusSeats.txt" file -----> Marking seat [1A] as taken. -----> Marking seat [1B] as taken. -----> Marking seat [1C] as taken. -----> Marking seat [1D] as taken. -----> Marking seat [2A] as taken. -----> Marking seat [2B] as taken. -----> Marking seat [2C] as taken. -----> Marking seat [2D] as taken. -----> Marking seat [3A] as taken. -----> Marking seat [3B] as taken. -----> Marking seat [3C] as taken. -----> Marking seat [4A] as taken. -----> Marking seat [4B] as taken. -----> Marking seat [4C] as taken. -----> Marking seat [4D] as taken. -----> Marking seat [5A] as taken. -----> Marking seat [5B] as taken. -----> Marking seat [5C] as taken. -----> Marking seat [5D] as taken. -----> Marking seat [6A] as taken. *** Seat: [6A] has been upgraded *** -----> Marking seat [6B] as taken. -----> Marking seat [6C] as taken. *** Seat: [6C] has been upgraded *** -----> Marking seat [6D] as taken. *** Seat: [6D] has been upgraded *** -----> Marking seat [7A] as taken. *** Seat: [7A] has been upgraded *** -----> Marking seat [7B] as taken. *** Seat: [7B] has been upgraded *** -----> Marking seat [7C] as taken. *** Seat: [7C] has been upgraded *** -----> Marking seat [7D] as taken. *** Seat: [7D] has been upgraded *** -----> Marking seat [8A] as taken. -----> Marking seat [8B] as taken. -----> Marking seat [9D] as taken. -----> Marking seat [10A] as taken. *** Seat: [10A] has been upgraded *** -----> Marking seat [10D] as taken. -----> Marking seat [12A] as taken. -----> Marking seat [12B] as taken. -----> Marking seat [12C] as taken. *** Seat: [12C] has been upgraded *** -----> Marking seat [13A] as taken. -----> Marking seat [13C] as taken. *** Seat: [13C] has been upgraded *** -----> Marking seat [17A] as taken. *** Seat: [17A] has been upgraded *** -----> Marking seat [17D] as taken. *** Seat: [17D] has been upgraded *** -----> Marking seat [18B] as taken. -----> Marking seat [18C] as taken. -----> Marking seat [21C] as taken. -----> Marking seat [22C] as taken. -----> Marking seat [22D] as taken. -----> Marking seat [24D] as taken. *** Seat: [24D] has been upgraded *** >>> This program assigns seats for a commercial bus <<< The current seat assignment is as follows. * -- available seat X -- occupied seat U -- occupied upgraded seat A B C D == BUSINESS CLASS == Row 1 X X X X Row 2 X X X X Row 3 X X X * Row 4 X X X X Row 5 X X X X == ECONOMY CLASS == Row 6 U X U U Row 7 U U U U Row 8 X X * * Row 9 * * * X Row 10 U * * X Row 11 * * * * Row 12 X X U * Row 13 X * U * Row 14 * * * * Row 15 * * * * Row 16 * * * * Row 17 U * * U Row 18 * X X * Row 19 * * * * Row 20 * * * * Row 21 * * X * Row 22 * * X X Row 23 * * * * Row 24 * * * U Row 25 * * * * Enter the desired seat section: BUSINESS, ECONOMY or QUIT business -----> Marking seat [3D] as taken. *#*#*#*# This is your business class ticket *#*#*#*# Seat: 3D Price: $35.99 Have a safe and enjoyable trip! *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*# >>> This program assigns seats for a commercial bus <<< The current seat assignment is as follows. * -- available seat X -- occupied seat U -- occupied upgraded seat A B C D == BUSINESS CLASS == Row 1 X X X X Row 2 X X X X Row 3 X X X X Row 4 X X X X Row 5 X X X X == ECONOMY CLASS == Row 6 U X U U Row 7 U U U U Row 8 X X * * Row 9 * * * X Row 10 U * * X Row 11 * * * * Row 12 X X U * Row 13 X * U * Row 14 * * * * Row 15 * * * * Row 16 * * * * Row 17 U * * U Row 18 * X X * Row 19 * * * * Row 20 * * * * Row 21 * * X * Row 22 * * X X Row 23 * * * * Row 24 * * * U Row 25 * * * * Enter the desired seat section: BUSINESS, ECONOMY or QUIT business *#*#*#*# Sorry!!! BUSINESS section is Full *#*#*#*# >>> This program assigns seats for a commercial bus <<< The current seat assignment is as follows. * -- available seat X -- occupied seat U -- occupied upgraded seat A B C D == BUSINESS CLASS == Row 1 X X X X Row 2 X X X X Row 3 X X X X Row 4 X X X X Row 5 X X X X == ECONOMY CLASS == Row 6 U X U U Row 7 U U U U Row 8 X X * * Row 9 * * * X Row 10 U * * X Row 11 * * * * Row 12 X X U * Row 13 X * U * Row 14 * * * * Row 15 * * * * Row 16 * * * * Row 17 U * * U Row 18 * X X * Row 19 * * * * Row 20 * * * * Row 21 * * X * Row 22 * * X X Row 23 * * * * Row 24 * * * U Row 25 * * * * Enter the desired seat section: BUSINESS, ECONOMY or QUIT economy -----> Marking seat [8C] as taken. Would you like to upgrade your seat to have a meal included? (yes, no) no *#*#*#*# This is your economy class ticket #*#*#*# Seat: 8C Price: $25.50 ( REGULAR ) Have a safe and enjoyable trip! *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*# >>> This program assigns seats for a commercial bus <<< The current seat assignment is as follows. * -- available seat X -- occupied seat U -- occupied upgraded seat A B C D == BUSINESS CLASS == Row 1 X X X X Row 2 X X X X Row 3 X X X X Row 4 X X X X Row 5 X X X X == ECONOMY CLASS == Row 6 U X U U Row 7 U U U U Row 8 X X X * Row 9 * * * X Row 10 U * * X Row 11 * * * * Row 12 X X U * Row 13 X * U * Row 14 * * * * Row 15 * * * * Row 16 * * * * Row 17 U * * U Row 18 * X X * Row 19 * * * * Row 20 * * * * Row 21 * * X * Row 22 * * X X Row 23 * * * * Row 24 * * * U Row 25 * * * * Enter the desired seat section: BUSINESS, ECONOMY or QUIT economy -----> Marking seat [8D] as taken. Would you like to upgrade your seat to have a meal included? (yes, no) yes *** Seat: [8D] has been upgraded *** *#*#*#*# This is your economy class ticket #*#*#*# Seat: 8D Price: $29.32 ( UPGRADED ) Have a safe and enjoyable trip! *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*# >>> This program assigns seats for a commercial bus <<< The current seat assignment is as follows. * -- available seat X -- occupied seat U -- occupied upgraded seat A B C D == BUSINESS CLASS == Row 1 X X X X Row 2 X X X X Row 3 X X X X Row 4 X X X X Row 5 X X X X == ECONOMY CLASS == Row 6 U X U U Row 7 U U U U Row 8 X X X U Row 9 * * * X Row 10 U * * X Row 11 * * * * Row 12 X X U * Row 13 X * U * Row 14 * * * * Row 15 * * * * Row 16 * * * * Row 17 U * * U Row 18 * X X * Row 19 * * * * Row 20 * * * * Row 21 * * X * Row 22 * * X X Row 23 * * * * Row 24 * * * U Row 25 * * * * Enter the desired seat section: BUSINESS, ECONOMY or QUIT economy -----> Marking seat [9A] as taken. Would you like to upgrade your seat to have a meal included? (yes, no) yes *** Seat: [9A] has been upgraded *** *#*#*#*# This is your economy class ticket #*#*#*# Seat: 9A Price: $29.32 ( UPGRADED ) Have a safe and enjoyable trip! *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*# >>> This program assigns seats for a commercial bus <<< The current seat assignment is as follows. * -- available seat X -- occupied seat U -- occupied upgraded seat A B C D == BUSINESS CLASS == Row 1 X X X X Row 2 X X X X Row 3 X X X X Row 4 X X X X Row 5 X X X X == ECONOMY CLASS == Row 6 U X U U Row 7 U U U U Row 8 X X X U Row 9 U * * X Row 10 U * * X Row 11 * * * * Row 12 X X U * Row 13 X * U * Row 14 * * * * Row 15 * * * * Row 16 * * * * Row 17 U * * U Row 18 * X X * Row 19 * * * * Row 20 * * * * Row 21 * * X * Row 22 * * X X Row 23 * * * * Row 24 * * * U Row 25 * * * * Enter the desired seat section: BUSINESS, ECONOMY or QUIT quit The seat sales have been saved into "takenBusSeats.txt" file. ==== RIDE STATISTICS === This bus has 100 seats: 20 business class seats are occupied 29 economy class seats are occupied 15 economy class seats are upgraded The bus is 49.0% full. The total revenue for this ride is $1,516.68 Process finished with exit code 0 NEXT RUN: ---> adding BusSeatBusinessClass objects to this.seats ---> adding BusSeatEconomyClass objects to this.seats ---> Processing data from "takenBusSeats.txt" file -----> Marking seat [1A] as taken. -----> Marking seat [1B] as taken. -----> Marking seat [1C] as taken. -----> Marking seat [1D] as taken. -----> Marking seat [2A] as taken. -----> Marking seat [2B] as taken. -----> Marking seat [2C] as taken. -----> Marking seat [2D] as taken. -----> Marking seat [3A] as taken. -----> Marking seat [3B] as taken. -----> Marking seat [3C] as taken. -----> Marking seat [3D] as taken. -----> Marking seat [4A] as taken. -----> Marking seat [4B] as taken. -----> Marking seat [4C] as taken. -----> Marking seat [4D] as taken. -----> Marking seat [5A] as taken. -----> Marking seat [5B] as taken. -----> Marking seat [5C] as taken. -----> Marking seat [5D] as taken. -----> Marking seat [6A] as taken. *** Seat: [6A] has been upgraded *** -----> Marking seat [6B] as taken. -----> Marking seat [6C] as taken. *** Seat: [6C] has been upgraded *** -----> Marking seat [6D] as taken. *** Seat: [6D] has been upgraded *** -----> Marking seat [7A] as taken. *** Seat: [7A] has been upgraded *** -----> Marking seat [7B] as taken. *** Seat: [7B] has been upgraded *** -----> Marking seat [7C] as taken. *** Seat: [7C] has been upgraded *** -----> Marking seat [7D] as taken. *** Seat: [7D] has been upgraded *** -----> Marking seat [8A] as taken. -----> Marking seat [8B] as taken. -----> Marking seat [8C] as taken. -----> Marking seat [8D] as taken. *** Seat: [8D] has been upgraded *** -----> Marking seat [9A] as taken. *** Seat: [9A] has been upgraded *** -----> Marking seat [9D] as taken. -----> Marking seat [10A] as taken. *** Seat: [10A] has been upgraded *** -----> Marking seat [10D] as taken. -----> Marking seat [12A] as taken. -----> Marking seat [12B] as taken. -----> Marking seat [12C] as taken. *** Seat: [12C] has been upgraded *** -----> Marking seat [13A] as taken. -----> Marking seat [13C] as taken. *** Seat: [13C] has been upgraded *** -----> Marking seat [17A] as taken. *** Seat: [17A] has been upgraded *** -----> Marking seat [17D] as taken. *** Seat: [17D] has been upgraded *** -----> Marking seat [18B] as taken. -----> Marking seat [18C] as taken. -----> Marking seat [21C] as taken. -----> Marking seat [22C] as taken. -----> Marking seat [22D] as taken. -----> Marking seat [24D] as taken. *** Seat: [24D] has been upgraded *** >>> This program assigns seats for a commercial bus <<< The current seat assignment is as follows. * -- available seat X -- occupied seat U -- occupied upgraded seat A B C D == BUSINESS CLASS == Row 1 X X X X Row 2 X X X X Row 3 X X X X Row 4 X X X X Row 5 X X X X == ECONOMY CLASS == Row 6 U X U U Row 7 U U U U Row 8 X X X U Row 9 U * * X Row 10 U * * X Row 11 * * * * Row 12 X X U * Row 13 X * U * Row 14 * * * * Row 15 * * * * Row 16 * * * * Row 17 U * * U Row 18 * X X * Row 19 * * * * Row 20 * * * * Row 21 * * X * Row 22 * * X X Row 23 * * * * Row 24 * * * U Row 25 * * * * Enter the desired seat section: BUSINESS, ECONOMY or QUIT quit The seat sales have been saved into "takenBusSeats.txt" file. ==== RIDE STATISTICS === This bus has 100 seats: 20 business class seats are occupied 29 economy class seats are occupied 15 economy class seats are upgraded The bus is 49.0% full. The total revenue for this ride is $1,516.68 Process finished with exit code 0 SUBSEQUENT RUN: ---> adding BusSeatBusinessClass objects to this.seats ---> adding BusSeatEconomyClass objects to this.seats ---> Processing data from "takenBusSeats.txt" file -----> Marking seat [1A] as taken. -----> Marking seat [1B] as taken. -----> Marking seat [1C] as taken. -----> Marking seat [1D] as taken. -----> Marking seat [2A] as taken. -----> Marking seat [2B] as taken. -----> Marking seat [2C] as taken. -----> Marking seat [2D] as taken. -----> Marking seat [3A] as taken. -----> Marking seat [3B] as taken. -----> Marking seat [3C] as taken. -----> Marking seat [3D] as taken. -----> Marking seat [4A] as taken. -----> Marking seat [4B] as taken. -----> Marking seat [4C] as taken. -----> Marking seat [4D] as taken. -----> Marking seat [5A] as taken. -----> Marking seat [5B] as taken. -----> Marking seat [5C] as taken. -----> Marking seat [5D] as taken. -----> Marking seat [6A] as taken. *** Seat: [6A] has been upgraded *** -----> Marking seat [6B] as taken. -----> Marking seat [6C] as taken. *** Seat: [6C] has been upgraded *** -----> Marking seat [6D] as taken. *** Seat: [6D] has been upgraded *** -----> Marking seat [7A] as taken. *** Seat: [7A] has been upgraded *** -----> Marking seat [7B] as taken. *** Seat: [7B] has been upgraded *** -----> Marking seat [7C] as taken. *** Seat: [7C] has been upgraded *** -----> Marking seat [7D] as taken. *** Seat: [7D] has been upgraded *** -----> Marking seat [8A] as taken. -----> Marking seat [8B] as taken. -----> Marking seat [8C] as taken. -----> Marking seat [8D] as taken. *** Seat: [8D] has been upgraded *** -----> Marking seat [9A] as taken. *** Seat: [9A] has been upgraded *** -----> Marking seat [9D] as taken. -----> Marking seat [10A] as taken. *** Seat: [10A] has been upgraded *** -----> Marking seat [10D] as taken. -----> Marking seat [12A] as taken. -----> Marking seat [12B] as taken. -----> Marking seat [12C] as taken. *** Seat: [12C] has been upgraded *** -----> Marking seat [13A] as taken. -----> Marking seat [13C] as taken. *** Seat: [13C] has been upgraded *** -----> Marking seat [17A] as taken. *** Seat: [17A] has been upgraded *** -----> Marking seat [17D] as taken. *** Seat: [17D] has been upgraded *** -----> Marking seat [18B] as taken. -----> Marking seat [18C] as taken. -----> Marking seat [21C] as taken. -----> Marking seat [22C] as taken. -----> Marking seat [22D] as taken. -----> Marking seat [24D] as taken. *** Seat: [24D] has been upgraded *** >>> This program assigns seats for a commercial bus <<< The current seat assignment is as follows. * -- available seat X -- occupied seat U -- occupied upgraded seat A B C D == BUSINESS CLASS == Row 1 X X X X Row 2 X X X X Row 3 X X X X Row 4 X X X X Row 5 X X X X == ECONOMY CLASS == Row 6 U X U U Row 7 U U U U Row 8 X X X U Row 9 U * * X Row 10 U * * X Row 11 * * * * Row 12 X X U * Row 13 X * U * Row 14 * * * * Row 15 * * * * Row 16 * * * * Row 17 U * * U Row 18 * X X * Row 19 * * * * Row 20 * * * * Row 21 * * X * Row 22 * * X X Row 23 * * * * Row 24 * * * U Row 25 * * * * Enter the desired seat section: BUSINESS, ECONOMY or QUIT business *#*#*#*# Sorry!!! BUSINESS section is Full *#*#*#*# >>> This program assigns seats for a commercial bus <<< The current seat assignment is as follows. * -- available seat X -- occupied seat U -- occupied upgraded seat A B C D == BUSINESS CLASS == Row 1 X X X X Row 2 X X X X Row 3 X X X X Row 4 X X X X Row 5 X X X X == ECONOMY CLASS == Row 6 U X U U Row 7 U U U U Row 8 X X X U Row 9 U * * X Row 10 U * * X Row 11 * * * * Row 12 X X U * Row 13 X * U * Row 14 * * * * Row 15 * * * * Row 16 * * * * Row 17 U * * U Row 18 * X X * Row 19 * * * * Row 20 * * * * Row 21 * * X * Row 22 * * X X Row 23 * * * * Row 24 * * * U Row 25 * * * * Enter the desired seat section: BUSINESS, ECONOMY or QUIT economy -----> Marking seat [9B] as taken. Would you like to upgrade your seat to have a meal included? (yes, no) yes *** Seat: [9B] has been upgraded *** *#*#*#*# This is your economy class ticket #*#*#*# Seat: 9B Price: $29.32 ( UPGRADED ) Have a safe and enjoyable trip! *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*# >>> This program assigns seats for a commercial bus <<< The current seat assignment is as follows. * -- available seat X -- occupied seat U -- occupied upgraded seat A B C D == BUSINESS CLASS == Row 1 X X X X Row 2 X X X X Row 3 X X X X Row 4 X X X X Row 5 X X X X == ECONOMY CLASS == Row 6 U X U U Row 7 U U U U Row 8 X X X U Row 9 U U * X Row 10 U * * X Row 11 * * * * Row 12 X X U * Row 13 X * U * Row 14 * * * * Row 15 * * * * Row 16 * * * * Row 17 U * * U Row 18 * X X * Row 19 * * * * Row 20 * * * * Row 21 * * X * Row 22 * * X X Row 23 * * * * Row 24 * * * U Row 25 * * * * Enter the desired seat section: BUSINESS, ECONOMY or QUIT quit The seat sales have been saved into "takenBusSeats.txt" file. ==== RIDE STATISTICS === This bus has 100 seats: 20 business class seats are occupied 30 economy class seats are occupied 16 economy class seats are upgraded The bus is 50.0% full. The total revenue for this ride is $1,546.00 Process finished with exit code 0

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.util.Scanner;

/**
* @author
* @version
*/
public class BusSeatPlan
{
    public final static int FIRST_BUSINESS_CLASS_ROW = 1;
    public final static int LAST_BUSINESS_CLASS_ROW = 5;
    public final static int NUM_OF_ROWS = 25;
    public final static int NUM_OF_SEATS_PER_ROW = 4;
    private ArrayList<BusSeat> seats; // keeps all seat objects

    public BusSeatPlan()
    {
       this.seats = new ArrayList<BusSeat>();
       this.initializeSeatPlan();
    }

    private void initializeSeatPlan()
    {
       System.out.println("---> adding BusSeatBusinessClass objects to this.seats");
       for (int row = FIRST_BUSINESS_CLASS_ROW; row <= LAST_BUSINESS_CLASS_ROW; row++) {
            for (int seat = 0; seat < NUM_OF_SEATS_PER_ROW; seat++) {
                char rowLetter = (char)('A' + seat);
                this.seats.add(new BusSeatBusinessClass(row, rowLetter));
            }
       }
       System.out.println("---> adding BusSeatEconomyClass objects to this.seats");
       for (int row = LAST_BUSINESS_CLASS_ROW + 1; row <= NUM_OF_ROWS; row++) {
            for (int seat = 0; seat < NUM_OF_SEATS_PER_ROW; seat++) {
                char rowLetter = (char)('A' + seat);
                this.seats.add(new BusSeatEconomyClass(false, row, rowLetter));
            }
       }
    }

    public void applyTakenSeatsFromFile(Scanner fromFile)
    {
       while (fromFile.hasNextLine()) {
            String line = fromFile.nextLine();
            String[] params = line.split("\\s+");
            if (params.length >= 2) {
                int row = Integer.parseInt(params[0]);
                char rowLetter = params[1].charAt(0);...

By purchasing this solution you'll be able to access the following files:
Solution.zip.

$70.00
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats