Skip to content
Open
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
f8189d4
Create MiguelsProject
Marquez5301 May 6, 2020
1f63b64
Delete MiguelsProject
Marquez5301 May 6, 2020
6e65733
Update Contents.swift
Marquez5301 May 6, 2020
5e459ce
First revision, I added a FlightStatus enum in line 20
Marquez5301 May 7, 2020
c528326
Second revision, I added an Airport struct at line 29
Marquez5301 May 7, 2020
18e6f77
Third revision, I added a DepartureBoard class at line 44
Marquez5301 May 7, 2020
5efd7dc
Fourth revision, I added a a Flight struct aat line 60
Marquez5301 May 7, 2020
f48f00a
Fifth revision, I added a reference of DepartureBoard called myDeparture
Marquez5301 May 7, 2020
d27ec6d
Sixth revision, I added three instances to my Flight array and I appe…
Marquez5301 May 7, 2020
fceb172
Seventh revision, I added a For Loop to my ENUM
Marquez5301 May 7, 2020
a8d9733
Eighth revision, I re-wrote a For Loop with Case iteration on line 102
Marquez5301 May 7, 2020
b6d6f85
Ninth revision, I fixed myDeparture instance on line 84
Marquez5301 May 7, 2020
ffa3ab6
Tenth revision, I renamed OtherFlightStatus to FlightStatus2 on line 102
Marquez5301 May 7, 2020
a15176a
Eleventh revision, fixed my code on line 103
Marquez5301 May 8, 2020
557dedc
Twelfth revision, added a Date command at lines, 64, 71, 86, 87, 88
Marquez5301 May 8, 2020
0421a3e
Thirteenth revision, added NIL value at line 87
Marquez5301 May 8, 2020
c20827e
Fourteenth revision, I created a printDeparture2 func
Marquez5301 May 8, 2020
fcf7051
Fifteenth revision, I created an alertPassengers func on lines 147 -…
Marquez5301 May 8, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions AirportDepartures.playground/Contents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ import UIKit
//: e. Use a `String?` for the Terminal, since it may not be set yet (i.e.: waiting to arrive on time)
//:
//: f. Use a class to represent a `DepartureBoard` with a list of departure flights, and the current airport
enum FlighStatus: String {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the reason you deleted the previous enum?

case route = "EN Route - On Time"
case scheduled = "Scheduled"
case cancelled = "Cancelled"
case delayed = "Delayed"
case boarding = "Boarding"
enum FlighStatus: CaseIterable {
case EnRoute, Scheduled, Canceled, Delayed, Boarding
}
let numberOfChoices = FlighStatus.allCases.count
print(numberOfChoices)

struct Airport {
let planes: Int
Expand Down Expand Up @@ -80,7 +78,7 @@ struct Flight {
//: d. Make one of the flights have a `nil` terminal because it has not been decided yet.
//:
//: e. Stretch: Look at the API for [`DateComponents`](https://developer.apple.com/documentation/foundation/datecomponents?language=objc) for creating a specific time
let myDeparture = DepartureBoard(destination: "West Palm Beach", airline: "Turkish Airlines", flights: [], departureTime: "06:00am", terminal: 5, status: .route)
let myDeparture = DepartureBoard(destination: "West Palm Beach", airline: "Turkish Airlines", flights: [], departureTime: "06:00am", terminal: 5, status: _ )

let flight1 = Flight(pilots: 2, attendants: 2, passengers: 200, ticketClass: "Economy")
let flight2 = Flight(pilots: 2, attendants: 4, passengers: 100, ticketClass: "Business")
Expand All @@ -99,7 +97,12 @@ myDeparture.flights.append(flight3)
//:
//: d. Print out the current DepartureBoard you created using the function


func printDepartures() {
for flights in FlighStatus.allCases {
print(flights)
}
}
printDepartures()


//: ## 4. Make a second function to print print an empty string if the `departureTime` is nil
Expand Down