Question: write C++ program for the Police Traffic Dept. in the town of SUD. The police department wants to have a program that keeps track of

write C++ program for the Police Traffic Dept. in the town of SUD.

The police department wants to have a program that keeps track of illegal driving actions. Theses actions include general parking tickets, speeding ticket, and being charged for drinking and driving. The information is kept in a file called "actions.txt" where the first field is the license number (8 digit of type long), the second field refers to the number of parking tickets, the third field is the number of speed tickets and the last field is the number of times the car has been stopped for drinking and driving violence. A sample of such a file is shown below:

102241 10 3 1

102242 4 0 0

992943 20 7 2

992944 8 2 0

The data should be stored in four parallel arrays for processing. The entries in the arrays correspond to one another. For example, this record shows the driver with the plate number 102242 has been a fairly good driver because it only has 4 parking ticket, and has no record of speed or drunk driving. However, the driver with the plate number 992943 is not a good driver because it has 20 parking tickets, 7 speed tickets and has been cut twice for drunk driving.

When you start your program, it will look for a text file called "acion.txt", open it, and load the four arrays with the data contained there. Call the array Plates, ParkingTicket, SpeedTicket, and DrunkTicket, respectively. The first column of the file is stored in the Plates array, the second column of the file is stored in the ParkingTicket array and so on.

After reading the data read into array, you will prompt the user on the screen to enter commands (single characters). Your interface should look as follows:

P:Adding a parking ticket

S: Adding a speed ticket

D: Adding a drunk driving ticket

R: Print history of a particular car

A: Print history of all cars

Q: Quit the program

-------------------------------------------------

Enter a Command:

If the user enter P (capital P and Small p should be accepted), your program should ask the user for a plate number. This plate number should be searched and the corresponding value of the parking tickets in ParkingTicket array should be incremented. For example if the user enters, 992943, your program should find out that the person with the plate number 992943 has already 20 parking tickets and should increment it by one to become 21.

Similarly if the user picks S option in the menu, the program should ask the user for the plate number and add one to the corresponding speed ticket. For example, if the plate number entered is 102241, you need to ensure that the speed ticket in SpeedTicket Array for this plate number is changed to 4.

Option D words as option P and S.

If the user chooses option R (or r), your program again asks for the plate number from the user and prints the associated history on the screen. For example, if the user enters 992944, your program should print:

The plate number is:992944

Number of parking tickets:8

Number of speed tickets:2

Number of drunk driving::0

If the user chooses option A (or a), your program should print all the information in a table format on the screen as follows:

PlateNo ofNo ofNo of

NumberParkingSpeedingDrinking

--------------------------------------------------------------------------------------------

1022411031

102242400

9929432072

992944820

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!