KRIGGA
10-25-01, 04:08 PM
hey i need some help w/ my cs program.. if any of u kno these functions can u jus send me whatever u kno.. Thanks
1.)
write a function called fine which will accept an integer(represents a speed limit) and a real(speed car was going when speed was violated). The function returns the fine imposed(real). The fines are $20.00 if < 10 mph over the speed limit; $75.00 for 10-20 mph over the limit(inclusive); and $150.00 if >20mph over the limit. You may assume that the car was traveling in excess of the speed limit.
2.)
write a function called "fine" which will accept an integer, a real, and a Boolean as its arguments. The integer represents a speed limit, the real the speed a car was going when it violated the speed limit, and the boolean will be true if the car was in a "work zone" when the violation occurred. The function returns the fine imposed (a real). The fines outside a work zone is double the normal fine. You may assume the car was traveling in excess of the speed limit.
3.)
write a predicate function called "isInvalidGrade" which accepts an integer grade as its only argument. The function returns true if the grade is invalid, and false otherwise. Valid grades are in the range 0 through 100 inclusive.
4.)
write a function called "warningValue" which accepts three integer grades as its arguments. The function either returns the integers -1, 2, or 1, based on the validity of the grades and their average if they are valid. The function is to return -1 in the case that any of the grades is invalid; 1 if the averageof the grades is 80.0 or above, and 2 if the average is below 80.0
5.)
write a predicate function called "firstBetter" which accpets two real, integer pairs as its arguments(in order real, integer, real, integer). Each pair represents the cost of a number of units of a particular item, and the number of units offered for that price. The function is to reurn true if the first pair represents a better "deal" (lower cost per unit) than the second pair. It is also to return true if the two "deals" are the same. It is only to return false if the second is actually the better of the two. You may assume that the kind of unit is the same for both pairs.
1.)
write a function called fine which will accept an integer(represents a speed limit) and a real(speed car was going when speed was violated). The function returns the fine imposed(real). The fines are $20.00 if < 10 mph over the speed limit; $75.00 for 10-20 mph over the limit(inclusive); and $150.00 if >20mph over the limit. You may assume that the car was traveling in excess of the speed limit.
2.)
write a function called "fine" which will accept an integer, a real, and a Boolean as its arguments. The integer represents a speed limit, the real the speed a car was going when it violated the speed limit, and the boolean will be true if the car was in a "work zone" when the violation occurred. The function returns the fine imposed (a real). The fines outside a work zone is double the normal fine. You may assume the car was traveling in excess of the speed limit.
3.)
write a predicate function called "isInvalidGrade" which accepts an integer grade as its only argument. The function returns true if the grade is invalid, and false otherwise. Valid grades are in the range 0 through 100 inclusive.
4.)
write a function called "warningValue" which accepts three integer grades as its arguments. The function either returns the integers -1, 2, or 1, based on the validity of the grades and their average if they are valid. The function is to return -1 in the case that any of the grades is invalid; 1 if the averageof the grades is 80.0 or above, and 2 if the average is below 80.0
5.)
write a predicate function called "firstBetter" which accpets two real, integer pairs as its arguments(in order real, integer, real, integer). Each pair represents the cost of a number of units of a particular item, and the number of units offered for that price. The function is to reurn true if the first pair represents a better "deal" (lower cost per unit) than the second pair. It is also to return true if the two "deals" are the same. It is only to return false if the second is actually the better of the two. You may assume that the kind of unit is the same for both pairs.