You are designing a machine to serve food at a cafeteria. Each customer's order is represented by a 5-bit number, where each bit represents whether the order contains Apples, Bananas, Cherries, Dates, or Edamame (from least significant to most significant bit).
You are provided 6 functions:
- add_a, add_b, add_c, add_d, and add_e: Add one of the foods to the plate
- done: Call this when the entire plate is finished
These functions have no parameters and no return values. To make this problem easier, these functions do not clobber any registers.
Write a function that will assemble a plate. For each item that was ordered, call the appropriate function (add_a, add_b, add_c, add_d, and add_e), and then call done after all requested items have been added to the plate.
void build (int order);
It is possible to request an empty plate (in which case, only done will be called).
To encourage you to write an if-then structure with a minimum of duplicate code, don't call each function from more than one place in your code (only one call site for each function).
Expected solution length: Around 20 lines.
add_a, add_c, and done are called
Write your solution here