COMPUTER SCIENCE SET 1 6W4
1) Print and turn in each program as it is complete. Put the date and time submitted.
2) Document the contract and purpose for each program.
3) The examples can be done with a calculator, so I do not need to see this.
4) But, make sure you check and record for your tests.
5) Test with data used in your examples.
PROGRAM 1 - POWERS
PROGRAM 2 - RATIOS
v Declare constants for the following: (CONSTANT IDENTIFIERS SHOULD BE IN ALL CAPS)
§ 12 inches Function: feet->inches
§ 3 feet Function: yards->feet
§ 1760 yards Function: miles-> yards
§ 3 teaspoons Function: tablespoon->teaspoon
§ 16 tablespoons You get the idea. Feel free to create your own program name
§ 8 ounces
§ 4 cups
§ 4 quarts
v Write a program that will determine number of inches in a given number of miles reusing functions.
v Write a program that will determine the number of teaspoons in a gallon given the number of teaspoons reusing function.
v Find another set of conversions and write a series of functions for that.
v HINT: Always test with 1 and then another easy number.
v HINT: The function itself only contains constants and variables.
PROGRAM 3 – RATE
v Specific Problem
§ This is the Amusement Park Graphing Linear Function scenario from worksheet and Quiz.
§ Read those directions to understand the specific problem.
v General Problem
§ Write a function that will determine the distance from a location at any point in time until arrival. The distance from the location and the rate you are driving are constants. The program consumes the minutes you have driven.
§ Declare a CONSTANT for the distance from the location.
§ Declare a CONSTANT for the rate you are driving.
§ Create 2 new scenarios to use as examples
§ Test with data from the worksheet and quiz. You have already done the examples.
§ Test with your examples.
§ Assume that the time is less than or equal to the amount needed for arrival:
§ 0 < Time < Distance/Rate
§ Formula is D = RT so T = D/R