-
Notifications
You must be signed in to change notification settings - Fork 241
Donna Mayfield Airport Playground Project #163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
swift-student
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent job on this assignment, Donna! Your code is again nice and clean and easy to read. It is really evident that you take pride in your work, and you are doing well with the concepts from the first few modules. Keep up the great work!
| init(city: String, destination: Airport) { | ||
| self.airport = destination | ||
| self.flights = [] | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You pass in a String to the parameter city but you don't use that anywhere in your initializer. Consider instead passing in an array of flights in addition to the airport, in case you wanted to initialize the departure board with some airports from the start.
init(flights: [Flight], airport: Airport) {
self.airport = airport
self.flights = flights
}| switch flight.flightStatus { | ||
| case .canceled: | ||
| print("We're sorry your flight to \(String(describing: flight.terminal)) was canceled, here is a $500 voucher") | ||
| case .scheduled: | ||
| print("Your flight to \(flight.airline) is scheduled to depart at \(String(describing: flight.departTime)) from terminal: \(String(describing: flight.terminal))") | ||
| case .boarding: | ||
| print("Your flight is boarding soon, please head to terminal: \(String(describing: flight.terminal)) immediately. The doors are closing soon.") | ||
| default: | ||
| print("Please check the departure board for your flight status.") | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice use of a switch statement. This looks great!
| print(formatter.string(from: NSNumber(value: calcFare(checkedBags: 10, distance: 1000, travelers: 4))) ?? 0) | ||
| print(formatter.string(from: NSNumber(value: calcFare(checkedBags: 5, distance: 2000, travelers: 1))) ?? 0) | ||
| print(formatter.string(from: NSNumber(value: calcFare(checkedBags: 1, distance: 1500, travelers: 1))) ?? 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love that you used the number formatter, as well as the nil coalescing operator.
| let flight1 = Flight( | ||
| flightNo: "DL1104", | ||
| airline: "Delta", | ||
| departTime: Date(), | ||
| terminal: nil, | ||
| flightStatus: .landed) | ||
|
|
||
| let flight2 = Flight( | ||
| flightNo: "AA302", | ||
| airline: "American Airline", | ||
| departTime: Date(), | ||
| terminal: "4", | ||
| flightStatus: .enRoute) | ||
|
|
||
| let flight3 = Flight( | ||
| flightNo: "DL5675", | ||
| airline: "Delta", | ||
| departTime: nil, | ||
| terminal: nil, | ||
| flightStatus: .canceled) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice use of returns on the parameters to make things read very clearly.
|
|
||
|
|
||
|
|
||
| for flight in departureBoard.flights { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This loop should ideally go inside of the alertPasengers() function in your departure board class. The instructions are confusing on this though, as the step is listed way down here, yet your class is up at the top. I definitely won't hold it against you, but just thought you should know.
@swift-student