Problem

An event organisation team in charge of organising multiple events keeps records using a computer program. This program uses two files (named events.txt and attendees.txt) which store details on the events available and on the participants who have booked or will book with the organisers, respectively. The files use lines with the following format for storing information.

events.txt
EventCode Location Country StartDay StartMonth Duration Price

Each line contains 8 pieces of information about an event separated by a space. The first is a unique alphanumeric code associated to each event, the next four pieces of information represent location and country, respectively in alphabetic format, followed by start day and month expressed as positive integers. The duration is expressed in number of days and the price is in euro.

attendees.txt
Name Surname BookingID EventCode Registration Paid Discount

Each line contains 7 pieces of information about customers, separated by space. The first two pieces of information represent the customer name and surname, the third and fourth and BookingID and EventCode as alphanumeric codes, the fifth is the event Registration cost and the sixth is Paid and indicates how much did the attendee has paid so far. Discount indicates a potential discount expressed as percentage from the original price which is applied to the event registration cost.

You are required to develop a program which will perform the following steps:

1. Read the data from these files into two arrays of structures. Assume a maximum of 20 characters for each alphabetic name or alphanumeric code. Note there are no spaces introduced between the potential multiple words of any name. Once read, the program should not allow data to be read again from the files and a warning message will be displayed instead. It is assumed that there are no more than 1000 entries in each file.

2. For each participant who has booked at least 10 days for the event, apply a discount of 10% and update the cost. For all participants who are going to Spain, apply an additional 5% discount and update the cost.

3. Ask for a customer name and amount of money to be paid. Search for the customer in the data structure and if found, record the payment. Print the amount which is still due or if a refund is due. Print a message if the customer name is not found.

4. Ask the user to input an event code. Print on the screen the list of attendees who are registered for the event with that code and for each customer data in the following format:

| Name | Surname| EventCode | Location | Cost| Paid |
| John | OBrien | 1A5B23 | Paris | 1000| 450 |

5. Read a file name from the keyboard, and write in a file with that name (5 marks) all customer-related information for the events which were fully paid in the following format:

Name Surname BookingID Location StartDay StartMonth Duration Price
e.g. John OBrien 145CD2 Paris 23 06 10 1050

The program should include at least three functions, demonstrate good coding practices with regard to spacing, indentation, commenting, etc. and offer the user a menu and repeated access to the program options

File Listing: events.txt

1A5B23 Paris France 23 6 10 1050
1A5B24 Paris France 23 6 7 750
1A6B25 Bucuresti Romania 30 6 7 950
1A6B26 Bucuresti Romania 30 6 10 1250
1A5M27 Madrid Spain 1 7 10 1200
1A5M28 Madrid Spain 5 7 7 850
1A6M29 Valencia Spain 1 7 7 1000
1A6M30 Valencia Spain 10 7 10 1400
3B1C82 Zagreb Croatia 11 7 7 650
3B1C83 Zagreb Croatia 11 7 10 950
3B1D43 Dubrovnik Croatia 11 8 10 1150
3B1D44 Dubrovnik Croatia 18 8 7 950
3B2E23 Zagreb Croatia 12 7 7 650
3B2E24 Zagreb Croatia 12 7 10 800

File Listing: attendees.txt

Jimmy OBrien 145CD2 1A5B23 1050 300 0
David Keogh 145CD3 1A5B26 1250 500 0
David Hanahoe 145CD4 1A5B23 1050 1050 0
Tom Byrne 145CD5 1A5M27 1200 1000 0
Thomas Collins 145CD6 3B2E23 650 650 0
Aoife Murphy 145CD7 3B2E23 650 200 0
Joan OBrien 145CD8 3B1D43 1150 800 0
Barbara Kehoe 145CD9 3B1C83 950 700 0
Celine Keogh 145CE1 3B1C83 950 500 0
Eva Swan 145CE2 3B2E24 800 800 0
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.