Quiz: Part D: Coding Question 2

Part D: Coding Question 2


Quiz instructions

This section of the exam will require you to write code into files and then submit these files to the appropriately named file upload points. Please make your code readable and use comments to explain what you are doing.


This question is worth 17 marks but you must submit code below to get these marks. Read this question carefully, write the code, and then submit the individual files to the correct hand-in points. In this questions you have to write the class declarations for a system that represents the fuel flow and control systems for a satellite delivery rocket.

Write declarations for the following classes. Note you only need the class declarations, not implementation of the functions.

FuelFlowSensor

This class contains the following private members:

time: a value representing the time for a given flow reading. You can decide what sort of time you wish to store.

● flow: a value representing the the flow at the sensor point at the time represented by time. Flow can be positive or negative.

This class should have a constructor and public accessor functions for its values.

FuelRecordStation

This class contains the following private members:

● id: an identifier for this station.

● readings: an array of the last 1000 fuel flow sensor readings.

● launch_date the date when the fuel started flowing for a launch.

● pipeline: which pipe this station monitors.

● section: which rocket section this station is on.

You should make decision as to how you will number or name various parts of the rocket, using short comments to explain your decisions.

This class should have a constructor and public accessor functions for its values. It should also have a function for getting the current time so it is able to add the right date to the next temperature reading. In addition it should have a public function that is called to add another reading at the current time.

Rocket

This class contains the following private member

● flowMeters: an array of Fuel Record Stations associated with this rocket

● name: the name of the rocket.

This class should have a constructor and public accessor functions for its values. It should also have a function to add a new station. It should also have a function to report the total flow across every meter at a given time.

Note again, you only have to write class declaration headers not actual code implementations of the functions.