Skill set for this LAB:
Problem 1 : Write a program that calculates the insurance points that three different people will receive for speeding on highway. The upper speed limit on the highway is 65 mph. You can assume that speed is integer number. Use the following table:
4 points: | over 90 mph |
3 points: | 89 - 80 |
2 points: | 79 - 70 |
1 point: | 69 - 66 |
NO POINTS: | 65 and less |
Problem 2 : Highway 1 has only even exit numbers between 2 and 20 inclusive. Highway 2 has only odd exit numbers between 1 and 19 inlusive. Due to the constructions, each highway has different speed limits on various exits defined by the tables below.
Write a program that reads TWO exit numbers and outputs the speed limit for each exit. Pay attention, your program must check if the exit is even or odd and call an appropriate function. Also, if the input is outside of the exit range, your program must print the error message.
For example, if the input is 7, 21. The output will be: 65 mph, invalid input. And if the input is 10, 11. The output will be 55 mph, 50 mph.
EXITS: | Speed Limit |
2 - 6: | 65 mph |
8 - 16: | 55 mph |
18 - 20: | 50 mph |
EXITS: | Speed Limit |
1 - 3: | 55 mph |
5 - 9: | 65 mph |
11 - 13: | 50 mph |
15 - 19: | 45 mph |
Problem 3 : Write a function aveDigits that finds and prints an average of the digits of the 4-digit positive integer. Write a function average that finds and prints an average of three integer numbers. Write a function aveLast that finds and prints an average of the last digits of three integer numbers. Write a program that first reads 1 integer, if the integer is positive and even, the program reads 3 integers and finds their average. If the number is positive and odd, the program reads 3 integers and finds the average of their last digits, otherwise, the program asks user to enter one 4-digit integer number and finds the average of the digits of the input number.