Question: I NEED THIS IN C, NOT C++, ALSO PLEASE DONT USE POINTERS OR MALLOC FUNCTIONS In this assignment you will write a data maintenance program

I NEED THIS IN C, NOT C++, ALSO PLEASE DONT USE POINTERS OR MALLOC FUNCTIONS

In this assignment you will write a data maintenance 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, you need to initialize the four arrays with the data of the below table .The name of arrays are: Plates, ParkingTicket, SpeedTicket, and DrunkTicket, respectively. The first column of the Table is the data for the Plates array, the second column of the Table is the data for 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 like this:

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.

Option Q should quit your program

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 follow (you need to enter the following information into your arrays)

Plate No of No of No of

Number Parking Speeding Drinking

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

102241 10 3 1

102242 4 0 0

992943 20 7 2

992944 8 2 0

112200 10 3 1

112201 4 0 0

112202 20 7 1

102203 2 3 2

102204 5 3 2

102205 10 3 1

102206 11 2 1

102207 22 8 3

102208 0 0 0

102209 0 0 0

102210 1 3 1

102211 2 2 0

102212 4 2 1

102213 6 2 0

102214 8 1 0

102215 9 1 0

102216 21 2 0

102217 13 2 0

102218 4 1 0

102219 4 1 0

102220 34 22 4

Testing your program

Add a parking ticket for plate number 102207

Print history of record 102207 on the screen

Add a parking ticket for plate number 102219

Print history of record 102219 on the screen

Add a parking ticket for plate number 102221

In this case, your program should print a message that plate 102221 cannot be found and asks the user to re-enter the plate number again

Add a speed ticket for plate number 102200

Print history of record 102200 on the screen

Add a parking ticket for plate number 102205

Print history of record 102205 on the screen

Add a parking ticket for plate number 102119

In this case, your program should print a message that plate 102119 cannot be found and asks the user to re-enter the plate number again

Add a drunken driving ticket for plate number 102201

Print history of record 102201 on the screen

Add a drunken driving ticket for plate number 102203

Print history of record 102203 on the screen

Add a drunken driving ticket for plate number 112204

In this case, your program should print a message that plate 112204 cannot be found and asks the user to re-enter the plate number again

Choose option A to print the information of all plates on the screen.

Quit the program

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 Databases Questions!