Skip to content

Conversation

@donnacadi
Copy link

Copy link

@swift-student swift-student left a 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!

Comment on lines +46 to +49
init(city: String, destination: Airport) {
self.airport = destination
self.flights = []
}

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
}

Comment on lines +161 to +170
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.")
}

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!

Comment on lines +204 to +206
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)

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.

Comment on lines +75 to +94
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)

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 {

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants