8.12
Lecture 5: The table method
This assignment is due on Sunday, January 21 at 11:59pm. Submit it using Handin as assignment lecture5. Your submission is only accepted if the message “Handin successful” appears.
1 Designing a function with 2 inputs
Exercise 1.
Design a function named coins that takes as inputs how many nickels
and how many dimes I have and calculates how many dollars I have in those coins.
Hint: If you need to review how to write a template, you can watch this
additional video.
The code written in the videos above is
available for your reference.
To download it, don’t use “Save Page As” or “Save As”;
use “Save Link As” or “Download Linked File” in your Web browser.
If you can’t find the command, try right-clicking or two-finger-tapping or
long-pressing.
2 The table method
The Beginning
Student Tables tool is available online for your use.
Exercise 2. Use the table method to design a function ctof that converts a temperature in Celsius to a temperature in Fahrenheit. Submit your table as a screenshot, a photo, or a comment.
Exercise 3.
Use the table method to design a function combine-digits that combines two digits
(each an integer between 0 and 9) into an integer between 0 and 99.
The first given digit should become the first digit of the output (in other words, tens).
The second given digit should become the second digit of the output (in other words, ones).
Submit your table as a screenshot, a photo, or a comment.