Computer programming. algorithms. required inputs, outputs, and temporary variables needed, and correct pseudo-code and narrative descript? The Yuma police department has compiled a data file on all speeding violations during the last year in the Yuma area that, for reporting purposes, is divided into four quadrants. For each driver involved in a speeding violation, a record is prepared containing the following data: VIN, quadrant, speed limit, actual speed Design an algorithm to produce two reports. First give a listing of speeding fines collected, where the fine is calculated as the sum of court costs ($200) plus $9.50 for every mile per hour by which the speed limit was exceeded. Prepare a report with the one line heading (goes before any other printing): Speeding Violations Report and print out the following information for each violation VIN: Fine: This report is to be followed by a second report, in which an analysis of violations by quadrant is given. For each of the four quadrants give the number of violations and the total fines collected for the quadrant. A VIN of 0 is to be used as the sentinel value.

To design an algorithm that produces two reports based on the speeding violations data file, we need to identify the required inputs, outputs, and temporary variables needed. We will also provide correct pseudo-code and a narrative description.

Inputs:
– Data file containing records of speeding violations
– Sentinel value (VIN = 0)

Outputs:
1. Speeding Violations Report:
– VIN (Vehicle Identification Number)
– Fine amount for each violation

2. Quadrant Analysis Report:
– Number of violations for each quadrant
– Total fines collected for each quadrant

Temporary variables:
– TotalFine: total fine for each violation
– TotalFinesCollected: total fines collected for each quadrant
– ViolationCount: number of violations for each quadrant

Pseudo-code for the algorithm:

1. Read the first record from the data file.
2. Initialize TotalFinesCollected and ViolationCount for each quadrant to zero.
3. Print the heading for the Speeding Violations Report.
4. Repeat steps 5-10 until the VIN equals the sentinel value.
5. Calculate TotalFine as the sum of court costs ($200) plus $9.50 for every mile per hour above the speed limit.
6. Add TotalFine to the TotalFinesCollected for the respective quadrant.
7. Increment ViolationCount for the respective quadrant.
8. Print the VIN and TotalFine for the current violation.
9. Read the next record from the data file.
10. End the loop.
11. Print a blank line.
12. Print the heading for the Quadrant Analysis Report.
13. For each quadrant, print the quadrant number, ViolationCount, and TotalFinesCollected.
14. End the algorithm.

Narrative description of the algorithm:

The algorithm starts by reading the first record from the data file and initializing the TotalFinesCollected and ViolationCount for each quadrant to zero. It then prints the heading for the Speeding Violations Report.

Next, it enters a loop that calculates the TotalFine for each violation based on the court costs and excess speed over the speed limit. It adds the TotalFine to the TotalFinesCollected for the respective quadrant and increments the ViolationCount for that quadrant. The VIN and TotalFine for the current violation are then printed.

Once the loop reaches the sentinel value (VIN = 0), the algorithm prints a blank line and proceeds to print the heading for the Quadrant Analysis Report.

For each quadrant, the algorithm prints the quadrant number, the ViolationCount, and the TotalFinesCollected. Finally, the algorithm ends.

Need your ASSIGNMENT done? Use our paper writing service to score better and meet your deadline.


Click Here to Make an Order Click Here to Hire a Writer