This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
When I run the program its saying it can't find the row symbol and it's probably because I didn't declare it yet, but the row input is set in another method, I want assignFirstClass to check whether the user enters 1 for row one or 2 for row two and if the user inputs anything else such as a letter or any numbers that are not 1 or 2 they will recieve a message saying Invalid row, you may only choose row 1 or 2! Would assignFirstClass call the method chooseSeat somehow?
A few comments about assignFirstClass:
1. Do you need to declare rowStart and rowEnd ? Maybe rowStart, if the first class seats are not the first seats in the place. But rowEnd ? You already have FIRST_CLASS_ROWS.
2. You call isFirstClassFull and print a message, but you don't return.
3. It seems logical to make chooseSeat return the chosen seat
Moreover, I think you should declare where each section starts from and ends to, in some variables. Smoking seats are from 8 to 13 rows, Non smoking seats are from 3 to 7... Get all these hard coded numbers out of the methods. By doing so, you'll be able to get rid of FIRST_CLASS_ROWS.
File headers: We don't need to see those; you're already asking us to look at almost 500 lines of code--make it as easy as possible.
Needless repetitive redundancy: What's the purpose of this?Why do you initialize the value twice?Use your constants. You defined constants for the values you're initializing to (delta an index tweak). Why bother, if you're not going to use them everywhere? Sure source of error at some point.
Maximize vertical locality. Declare your variables near their first use; doing so clearly separates functional "chunks" and reduces cognitive overhead. It also makes spotting refactorings easier.
Use math when you can. The following is math, not conditional (delta a range check):Looks like colNo = col - 'A', no? A range check before the math ensures validity. The same holds true for the (col != 'A' && col != 'B' && etc...)--there's no need to spell out each entry by hand, and it's brittle and error-prone.
"End of fooBar method" comments: Ditch them; useless noise. If your indentation is correct it's obvious where they end, and there's already a big Javadoc chunk before the next method.