21. Worksheet A

Practice with the computer structure and helper functions.
  1. Write a data description for a structure “computer” that stores the memory (e.g., 4GB), used hard disk space (e.g., 104.9 GB) , and has a textual description of its location (e.g., “leftmost computer by the window”).
  2. Write the definition for this structure.
  3. Create the computer from the example above.
  4. Test your code by showing that the location of the computer you made is “leftmost computer by the window”.
  5. Design and test a function that is true when the computer has at least 4GB of memory.
  6. Design and test a function “empty-trash” which takes a computer and decreases the used hard disk space by 15% (producing a computer).
Last modified August 18, 2023: 2022-2023 End State (7352e87)