Mixed Seasoning Let’s say we have two int variables (day and month) that together represent a valid day of the year. The following code tries to draw a background sprite based on the season expressed...


Mixed Seasoning Let’s say we have two int variables (day and month) that together represent a valid day of the year. The following code tries to draw a background sprite based on the season expressed by this day and month. For simplicity, we only look at spring and summer, so we assume that the value of month lies between 4 and 8 (meaning between April and August). Note: The (astronomical) summer season begins on June 21.


a. Does this code always draw the correct background sprite? (Hint: no!) Find a combination of day and month that gives us the wrong answer. b. Write a variant of this code that does work correctly for all dates (between April and August). c. Extend your code to support autumn and winter as well.

Nov 20, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here