Submit a well-formatted pull request to our class blog with embedded Trinket programs for the below exercises from Chapter 4 (use these instead of the ones in the book). Complete these on your own, using only the materials in this Chapter. Do not look at other students’ submissions until after you’ve completed your work.
After your programs are done, check other students’ work and other resources online if you had questions. Include a reflection about what you think you’ve learned and any concepts that are still fuzzy to you. Did you encounter frustrating situations? Did you feel a lightbulb turn on?
Note: There’s nothing to turn in for the exercises not listed below, but you should still do them and understand them. Exercises 2-3 in the chapter can be completed using the embedded trinket in the book. Exercise 1 can be completed in a trinket you make or the console on our class site.
Exercise 6: Rewrite your pay computation with time-and-a-half for overtime and create a function called computepay which takes two parameters (hours and rate).
Enter Hours: 45
Enter Rate: 10
Pay: 475.0
Exercise 7: Rewrite the grade program from the previous chapter using a function called computegrade that takes a score as its parameter and returns a grade as a string.
Score Grade
> 0.9 A
> 0.8 B
> 0.7 C
> 0.6 D
<= 0.6 F
Program Execution:
Enter score: 0.95
A
Enter score: perfect
Bad score
Enter score: 10.0
Bad score
Enter score: 0.75
C
Enter score: 0.5
F
Run the program repeatedly to test the various different values for input.