In this exercise you'll be writing code to analyze the production of an assembly line in a car factory. The assembly line's speed can range from
0 (off) to
At its lowest speed (
221 cars are produced each hour. The production increases linearly with the speed. So with the speed set to
4, it should produce
4 * 221 = 884 cars per hour. However, higher speeds increase the likelihood that faulty cars are produced, which then have to be discarded. The following table shows how speed influences the success rate:
0: 0% success rate.
4: 100% success rate.
8: 90% success rate.
9: 80% success rate.
10: 77% success rate.
You have three tasks.
successRate function to calculate the success rate based on the production speed:
successRate 6 // => 0.9
productionRatePerHour function to calculate the assembly line's production rate per hour, taking into account its success rate:
productionRatePerHour 6 // => 1193.4
Note that the value returned is a
workingItemsPerMinute function to calculate how many working cars are produced per minute:
workingItemsPerMinute 6 // => 19
Note that the value returned is an