Define and test two Sifflet functions using numerical and conditional expressions.
This lab is for the assessment of two competencies: 07-1 (SiffNum) and 07-2 (SiffCond).
Coding Standards through Chapter 9 apply to this lab. While the coding standards are actually for Python code, apply the spirit of the standards also to Sifflet programs—for example, use descriptive variable and function names.
You'll need to use Sifflet for each of these problems.
A restaurant specializes in pie, cake, and ice cream. They sell pie at $1.25 per slice, cake at $2.50 per slice, and ice cream at $0.80 per scoop. There is a sales tax of 7%. Define a Sifflet function to compute a customer's bill, including tax, with three parameters representing the number of slices of pie, cake, and scoops of ice cream.
Don't worry about rounding off to exact dollars and cents.
Testing: show your function's computation for 3 slices of pie, 5 of cake, and 7 scoops of ice cream. Take a screenshot and turn it in. (There is no need to turn in source code separately for Sifflet functions, since the diagram displays the source code expression tree as well as the actual computed values.)
Define a Sifflet function to compute fines for speeding, with two parameters, speed and limit. The parameter speed is the driver's actual speed, and limit is the speed limit. The function should compute a driver's fine, if any, for speeding, according to these rules:
Again, don't worry about rounding to exact dollars and cents.
Testing: Test your function for these two cases:
Take screenshots of both tests and turn them in.
Turn in the following in Oncourse Assignments:
(CA = Competency Assessment, all or nothing; pca = partial credit is available)
Scores for the competencies are not recorded separately, and they are not "all or nothing." If you earn significantly less than passing on both, you may get a chance to resubmit; but do try to get them right the first time!
Total: 10 points