Exercise 2.3 – Police System II (difficult)
This exercise continues the same system idea as Exercise 2.2 – converting loops. However, the code is from scratch. In addition, the system is now updated with our newly learned optimizations.
System description:
The police want a system that calculates fines for speeding tickets. The officer wants to provide a list that includes the following: the speed at which the driver was going, whether the driver has a license, and whether the driver was driving recklessly or not. Sometimes, the officer forgets to include something in this list. As a result, the driver might not get a ticket for the crime. Forgetting to include something can be used to exclude certain crimes, too. There should be a list that contains each crime that can be committed. You can find the price of each ticket if the driver commits the crime in each sub-list. Besides the price, there should also be a unique function for each crime that can be used to...