You will be developing a speeding ticket fee calculator. This program will ask for a ticket file, which is produced by a central police database, and your program will output to the console. Furthermore, your program will restrict the output to the starting and ending dates given by the user.
The ticket fee is calculated using four multipliers, depending on the type of road the ticket was issued:
1
2
3
4
Interstate multiplier: 5.2341
Highway multiplier: 9.4826
Residential multiplier: 17.1544
None of the above: 12.8334
The multiplier is multiplied to the difference between the speed limit and the clocked speed to determine the fine’s dollar amount.
You must ask the user on the console for an input ticket file, a report starting date, and a report ending date. The following prompts must be used:
1
2
3
"Enter a ticket file: "
"Enter report start date (mm dd yyyy): "
"Enter report end date (mm dd yyyy): "
Each line will contain the following information:
1
<citation number> <month> <day> <year> <clocked speed> <speed limit> <type of road>
Your output to the console will be:
1
<citation> <day>-<3-character Month>-<Year> $<fine>
Ethan Rickert (UTA Spring 2022) created a nice help page for more hints that you can view here:
https://ethan0429.github.io/COSC102-Lab-Writeups/labs/lab5.html
Valid input example:
1
2
3
4
./lab5
Enter a ticket file: ticket
Enter report start date (mm dd yyyy): 7 1 2017
Enter report end date (mm dd yyyy): 8 11 2018
ticket file contains:
1
2
3
4
E059564 8 12 2018 89 55 i
E515522 7 3 2017 105 50 r
E712221 6 4 2015 200 25 h
E219221 12 25 17 2000 10 p
output to the console contains:
1
2
E515522 03-Jul-2017 $ 943.49
E219221 25-Dec-2017 $ 25538.47
Missing file example:
1
2
3
./lab5
Enter a ticket file: somebadfilename
Unable to open somebadfilename.
Please review the plagiarism policy on the course syllabus.
Compile your code using the following
1
g++ -Wall -O0 -g -std=c++11 -o lab5 lab5.cpp
Submit your lab5.cpp. This file must be properly commented and formatted. If your program does not compile, it will not be graded.
1
cat input.txt | ./a.out