1
h01
CS24 F19
Name:
(as it would appear on official course roster)
Umail address: @umail.ucsb.edu section
Optional: name you wish to be called
if different from name above.
Optional: name of "homework buddy"
(leaving this blank signifies "I worked alone"

h01: Chapter 1.1, 2.1-2.2

ready? assigned due points
true Thu 09/26 12:00AM Wed 10/02 11:59PM

You may collaborate on this homework with AT MOST one person, an optional "homework buddy".

INSTEAD OF TURNING IN THIS HOMEWORK, YOU WILL TAKE A QUIZ ON GAUCHOSPACE BY THE DUE DATE.
There is NO MAKEUP for missed homework assignments.
The quiz will be made available at least two days before the due date.


Reading: Read Chapter 1.1, 2.1-2.2. If you don’t have a copy of the textbook yet, there is one on reserve at the library under “COMP000-STAFF - Permanent Reserve”.

    1. (5 pts) Name two benefits of procedural abstraction in writing code.
    2. (5 pts) Describe a technique for incorporating the principle of information hiding when describing a function's behaviour.
    3. (10 pts) Write the pre and post conditions for a function that takes as input two parameters: distance (in meters) and time (in seconds), and computes speed as output.
    4. (5 pts) Which access specifier should be used to hide member functions and variables from code outside of the class?
    5. (5 pts) What is the difference between a class and an object?
    6. (10 pts) Modify the definition of the throttle class on page 35, to create a new throttle ADT, which allows the user of the ADT to specify the number of shift levels when creating objects of that class. You don't need to provide an implementation of the new throttle ADT, just the class definition.
    7. (10 pts) Modify the definition of the throttle ADT on page 35, to create a new throttle ADT, which models a throttle as having a lever to control the flow of fuel (as before), and a light that indicates if the fuel flow is above or below a threshold. The light is green if the fuel flow is below 70%, and red otherwise. The new throttle ADT should have appropriate member functions to check on the status of the light. Implement the new throttle ADT
    8. (50 pts) Complete the CS 16 final exam available at this link. If you feel like printing it out, you may also use the following answer sheet.