2.3 Basic Scheme
You must complete this assignment by yourself.
You must submit this in an archive named "basic.zip".
You must submit this in a file named "basic.ss".
Develop the following functions and datatypes in the Beginning Student language.
(sum-coins pennies nickels dimes quarters) → number? |
pennies : number? |
nickels : number? |
dimes : number? |
quarters : number? |
The local supermarket needs a program that can compute the value of a bag of coins. sum-coins produces the amount of money in the bag.
(area-cylinder base-radius height) → number? |
base-radius : number? |
height : number? |
Returns the surface area of a cylinder.
You will want to use check-within to test this.
| |||||||||||||||||||||
inner-radius : number? | |||||||||||||||||||||
length : number? | |||||||||||||||||||||
wall-thickness : number? |
Computes the surface area of a pipe, which is an open cylinder.
You will want to use check-within to test this.
| |||||||||||||||||||||
inner-radius : number? | |||||||||||||||||||||
length : number? | |||||||||||||||||||||
wall-thickness : number? |
Write a version of area-pipe1 that uses several helper functions.
You will want to use check-within to test this.
Produces the amount of tax owed. For a gross pay of $240 or less, the tax is 0%; for over $240 and $480 or less,
the tax rate is 15%; and for any pay over $480, the tax rate is 28%.
Determines the net pay of an employee, which is the gross pay minus the tax. Assume the hourly pay rate is $12.
The function consumes the coefficients a, b, and c of a quadratic equation. It then determines
whether the equation is degenerate and, if not, how many solutions the equation has. The function produces one of four symbols:
'degenerate, 'two, 'one, or 'none. An equation is degenerate if (= a 0).
Represents points in time since midnight. Define using define-struct.
Returns the number of seconds from t1 to t2.
Represents two dimensional points.
Represents circles.
Represents squares.
Represents rectangles.
Computes the area of the shape.
You will want to use check-within to test this.
(translate-shape shape delta) → (or/c circ? square? rect?) |
shape : (or/c circ? square? rect?) |
delta : number? |
Produces a shape whose key position is moved by delta pixels in the x direction.