9618/32 October/November 2022 · Question 4 · 10 marks
(a) Declare the enumerated data type Aircraft (C300, C350, D242, E757, X380). (b) Declare the composite data type Flight: flight number, destination, departure date and type of aircraft. (c)(i) Set up a variable for one record of type Flight. (ii) Store the details of flight XA782 to Cambridge on 12/12/2022 with aircraft C350.
Points that gain marks
- (a) TYPE Aircraft = … (C300, C350, D242, E757, X380)
- (b) TYPE Flight and ENDTYPE correct.
- DECLARE FlightNumber and DECLARE Destination as STRING; DECLARE DepartureDate as DATE.
- DECLARE AircraftType as Aircraft (the type from part (a)).
- (c)(i) DECLARE Flight1 : Flight
- (ii) Both STRING values, the DATE value and the enumerated value assigned correctly: Flight1.DepartureDate ← 12/12/2022, Flight1.AircraftType ← C350.
In this lab: Levels 3 and 4 build exactly this record.