Question: QUESTION 17 Define a function named yearsToHours, which converts years to the total number of hours and returns the hours. Assume there are 365 days
QUESTION 17
Define a function named yearsToHours, which converts years to the total number of hours and returns the hours. Assume there are 365 days in a year. Then write a program that prompt the user to enter the number of years, and call yearsToHours function to show the number of hours that the years have. Use a main function in your program.
QUESTION 18
A supermarket awards coupons depending on how much a customer spends on groceries. For example, if you spend $50, you will get a coupon worth 8% of that amount. The following table shows the percent used to calculate the coupon awarded for different amounts spent. Write a program that asks the user to enter the cost and the program calculates and prints the value of the coupon a person can receive based on groceries purchased. If the user enters a negative cost, the program will exit.
Here is the same run:
Please enter a cost of your groceries: 14 [Enter]
You win a discount coupon of $1.12. (8% of your purchase)
| Money Spent | Coupon Percentage |
| Less than $10 | No Coupon |
| $10 ~ $59 | 8% |
| $60 ~ $149 | 10% |
| $150~$209 | 12% |
| $210 or more | 14% |
QUESTION 19
Write a turtle graphics program to draw the following shape:
Hint:
for i = 10, 20, 30,..., 250 do the following:
Walk forward i steps Turn left 90 degrees
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
