Hello, I'm having a little trouble with this exercise for Java. I'll insert the exercise question first. When doing the code, can you please insert comments to help me get a better understanding?
Create a new project in BlueJ and call it plane-project. Create 2 classes, Seat class and PlaneReservation class. As usual, add comments at the top of your class and for each method.
In the seat class: Set up fields for a seat number and a seat category (values can be business, Comfort plus, or economy). Both can be string data types. Code the constructor for the class, having the user supply the information through parameters. Code a routine to get the seat number. Code a routine to get the category. Code a routine to set the category to a different value. You can also code one to change the seat number but not required for the test. Code a routine to print the seat number and category. Code a routine to determine the price of the seat as follows: Set the category name to all uppercase. If the category name is “BUSINESS” the cost is $600, if it is “COMFORT PLUS” the cost is $400, and if it is “ECONOMY” the price will be $300. You can either return the price or print it out, whichever you prefer.
In the PlaneReservation class: Assume you are buying 2 seats on the flight. Set up fields for a name(String), 2 Seat objects, and a Scanner object. Code a Constructor for the class. You can hard-code values when you instantiate the seat objects, i.e put in a seat number and category in the call to the constructor of that class. Remember to instantiate the Scanner object too. Code a routine to get the name using the Scanner. The user should enter their first name, followed by a space and then their last name. Using String methods, create a name to put on the reservation which will consist of the last name, followed by a comma, followed by the first initial of the first name. Code a method to print the name and the info for each seat. Hint: Use methods of the Seat class whenever possible. Code a method to get the cost for both seats and print out. Code a method(s) in the PlaneReservation class to change the category of each seat and the seat numbers. Add code to check to see that the user entered his name with a space between his first name and last name. If he didn’t leave a space between names, print an error message. If he did, then proceed to construct the reservation name.