Homework 2
- Due No Due Date
- Points 10
- Submitting a file upload
- File Types cpp
Similar to Labs, Homework assignments also build on topics covered in previous weeks. As always, you're not allowed to use topics we haven't covered yet.
In problem 1, the third bullet point will require that, instead of utilizing shortcuts you can easily Google, you understand not just how the substring function works, but also how the integers that go into the parentheses are calculated. A consistent habit you'll want to develop is how to view everything you do in programming as formula, not as some static number. Create formulas for both numeric inputs of substr() such that your programs always calculate the EXACT number of characters needed regardless of the name inputted. Hint: Use integer division.
For the record, yes, the exact formula is not needed to get the code to generate the right text, but for full credit, the right formula (of which there still remain multiple solutions) is required from you. Shortcuts are not allowed, so you're limited to the 2-input version of substr() as shown in class.
In problem 2, you need to make sure that your program calculates all conversions correctly, which will include decimal inputs and outputs. After all, temperature is a value that can and often is represented with decimal accuracy, so make sure you're using the right variable types too. By the way, if your program output is zero, check that you're not using integer division by accident.
Rubric
Criteria | Ratings | Pts | |
---|---|---|---|
name.cpp
threshold:
pts
|
pts
--
|
||
temp.cpp
threshold:
pts
|
pts
--
|
||
Total Points:
10
out of 10
|