I want someone to write a program using C++

1. Declare three structs to store Athlete, Event and Registration details. The struct definitions are provided in Appendix 1.
2. Write the driver code (main) and declare an array object of type Registration, assuming you can have a maximum of 20 registrations. Also, declare a pointer for this array object that you can use to access the array elements in your program.
3. In the driver, write code to display a menu for the user with the following options. Each menu item may be selected by the user using the corresponding menu number. The menu should repeat after each selection until user enters 7 for exit.
1 – Read and display registration file
2 – List all athletes by event
3 – List all athletes by country
4 – Read and display result file
5 – List medal counts by country
6 – Display medal tally
7 – Exit
Implement each of the above menu options (1-6) in separate functions that you can call from your driver program. Below are the descriptions for each function, with the function prototypes given in Appendix 1 as a guide.
1 - The registration.txt file contains the registration ID, athlete and event details for each participating athlete. The function takes the registration array pointer (declared in step 2) as an input parameter, together with an integer size (passed as reference and used to count the number of records read in the array). The function should first ask the user to enter the complete path and filename for the input file (example C:\\registration.txt), which is read and stored in the registration array using the pointer. The function should then display the contents of the input file as read in the registration array.
2 - The function takes the registration array pointer, size and an event ID (which is entered by the user within the driver) as inputs and displays the athlete ID, name and country of all athletes registered for that event.
3 - The function takes the registration array pointer, size and a country name (which is entered by the user within the driver) as inputs and displays the athlete ID, name and event name for all athletes representing that country.
4 - The results.txt file contains the event ID and top three athlete IDs (representing gold, silver and bronze winners for that event). Assume there are no ties, no multiple medal winners and the input file can contain a maximum of 20 records (results) at a time. In your driver, declare a 2-D integer array (size 20x4) that can store the contents of the input file. The function should then take this 2-D array and an integer size (passed as reference and used to count the number of records read in the array) as inputs. It should first ask user to enter the complete path and filename for the input file (example C:\\result.txt), which is read and stored in the 2-D array appropriately. The function should then display the contents of the input file as read in the array.
5 - The function takes the registration array pointer, size, 2-D array, size and a country name (which is entered by the user within the driver) as inputs and displays the country name and the total number of gold, silver and bronze medals won by that country.
6 - The function takes the registration array pointer, size, 2-D array and size as inputs and lists all countries who have won a medal and display the total count of gold, silver and bronze medals for each country in some appropriate format4. You are not required to validate any keyboard entry unless otherwise stated. In cases where records do not exist, appropriate messages should be displayed. For example, in menu option 2, if the event ID entered by user is not found or does not have any athletes registered, then appropriate messages must be displayed. Furthermore, note that the first line in all input files contains the header line and must always be discarded in your program.
5. You are expected to use proper C++ programming standards in your program and the object oriented paradigm where necessary. You should also use comments to explain important parts of your code and state or comment clearly any assumptions made in the program.




CS112 Assignment 1, 2012
Appendix 1
Struct Definitions
struct Athlete struct Event struct Registration
{ { {
int aID; int eID; int rID;
string aName; string eName; Athlete rAthlete;
int aAge; string eRecord; Event rEvent;
char aGender; }; };
string aCountry;
};
Function Prototypes
1. void ReadRegistrations (Registration *regPtr, int &size);
2. void ListAthletesByEvent (Registration *regPtr, int size, int eID);
3. void ListAthletesByCountry (Registration *regPtr, int size, string country);
4. void ReadResults (int results[ ][4], int &size);
5. void ListMedalsByCountry (Registration *regPtr, int size1, results[ ][4], int size2, string country);
6. void ListMedalTally (Registration *regPtr, int size1, results[ ][4], int size2);



Appendix 2 – Input Files (available on Moodle)
registration.txt
result.txt
result.txt
Appendix 3 – Sample Output
RID AID AName AAge AGender ACountry EID EName ERecord
101 201 tony 28 m fiji 301 200m 20s
102 202 anna 30 f samoa 305 shotput 25m
103 201 tony 28 m fiji 302 400m 54s
104 203 pita 21 m vanuatu 301 200m 20s
105 203 pita 21 m vanuatu 304 discus 80m
106 204 sam 22 m tonga 301 200m 20s
107 205 lisa 28 f kiribati 305 shotput 25m
108 206 mere 32 f fiji 305 shotput 25m
109 207 kenny 29 f samoa 308 1500m 5m
110 208 raj 40 m fiji 310 200m 20s



result.txt
Appendix 3 – Sample Output
RID AID AName AAge AGender ACountry EID EName ERecord
101 201 tony 28 m fiji 301 200m 20s
102 202 anna 30 f samoa 305 shotput 25m
103 201 tony 28 m fiji 302 400m 54s
104 203 pita 21 m vanuatu 301 200m 20s
105 203 pita 21 m vanuatu 304 discus 80m
106 204 sam 22 m tonga 301 200m 20s
107 205 lisa 28 f kiribati 305 shotput 25m
108 206 mere 32 f fiji 305 shotput 25m
109 207 kenny 29 f samoa 308 1500m 5m
110 208 raj 40 m fiji 310 200m 20s

result.txt
EID AID1 AID2 AID3
301 201 203 208
302 202 205 206

Appendix 3 – Sample Output
Welcome to Athlete Registration and Result Program
Menu:
1 – Read and display registration file
2 – List all athletes by event
3 – List all athletes by country
4 – Read and display result file
5 – List medal counts by country
6 – Display medal tally
7 – Exit
Enter menu option: 1
Enter registration filename: C:\\registration.txt
RID AID AName AAge AGender ACountry EID EName ERecord
101 201 tony 28 m fiji 301 200m 20s
102 202 anna 30 f samoa 305 shotput 25m
103 201 tony 28 m fiji 302 400m 54s
104 203 pita 21 m vanuatu 301 200m 20s
105 203 pita 21 m vanuatu 304 discus 80m
106 204 sam 22 m tonga 301 200m 20s
107 205 lisa 28 f kiribati 305 shotput 25m
108 206 mere 32 f fiji 305 shotput 25m
109 207 kenny 29 f samoa 308 1500m 5m
110 208 raj 40 m fiji 310 200m 20s
Menu:
1 – Read and display registration file
2 – List all athletes by event
3 – List all athletes by country
4 – Read and display result file
5 – List medal counts by country
6 – Display medal tally
7 – Exit
Enter menu option: 2
Enter event ID: 305
AID Name Country
202 anna samoa
205 lisa kiribati
206 mere fiji
Menu:
1 – Read and display registration file
2 – List all athletes by event
3 – List all athletes by country
4 – Read and display result file
5 – List medal counts by country
6 – Display medal tally
7 – Exit

Enter menu option: 3
Enter country: samoa
AID Name Event
202 anna shotput
207 kenny 1500m
Menu:
1 – Read and display registration file
2 – List all athletes by event
3 – List all athletes by country
4 – Read and display result file
5 – List medal counts by country
6 – Display medal tally
7 – Exit
Enter menu option: 4
Enter result filename: C:\\result.txt
EID AID1 AID2 AID3
301 201 203 208
302 202 205 206
Menu:
1 – Read and display registration file
2 – List all athletes by event
3 – List all athletes by country
4 – Read and display result file
5 – List medal counts by country
6 – Display medal tally
7 – Exit
Enter menu option: 5
Enter country: fiji
Gold Silver Bronze
1 0 2
Menu:
1 – Read and display registration file
2 – List all athletes by event
3 – List all athletes by country
4 – Read and display result file
5 – List medal counts by country
6 – Display medal tally
7 – Exit
Enter menu option: 6
Country Gold Silver Bronze
fiji 1 0 2
samoa 1 0 0
kiribati 0 1 0
vanuatu 0 1 0
Menu:
1 – Read and display registration file
2 – List all athletes by event
3 – List all athletes by country
4 – Read and display result file
5 – List medal counts by country
6 – Display medal tally
7 – Exit
Enter menu option: 7
Press any key to continue…
This should be in the Jobs section.
How much are you paying?
Student's Project ? Or Need for showing for Server ?
Whatever ... Do you need Any GUI building too ?
Yeah .. But how much this job does pay ? ;-) But description and requirement posting is good :)
closed account (o3hC5Di1)
Hi there,

forum rules wrote:
Don't post homework questions
Programmers are good at spotting homework questions; most of us have done them ourselves. Those questions are for you to work out, so that you will learn from the experience. It is OK to ask for hints, but not for entire solutions.


In other words, we'll gladly help you finish your task - but you're the one who needs to do the coding.

Start your task and come back to us with specific problems you run in to.
If you need help getting started, just say so.

All the best,
NwN
Topic archived. No new replies allowed.