SlideShare a Scribd company logo
Any kind of help would gladly be appreciated. (C-programming)
Problem:
Charity Runs are a popular way for organizations to raise awareness and get fit at the same time.
However, these events can be tough to organize. The Princess Half Marathon Weekend, for
example, has as many as 40,000 runners raising money and awareness for the Children’s Miracle
Network Hospitals. People can run both 5ks and 10ks and there’s even a children’s race.
After nearly a semester of C programming, you've decided that you'd like to donate your skills
to create a program that organizes the typical activities for charity run weekend. In particular,
your program will help manage the following:
1) Individual Registration
2) Team Registration
3) Running Events
4) Donation Totals
Your program will log the number of teams and individual who are signed up for the different
races, process the racing events to see who has the fastest times, and track the total amount of
money raised by teams and individuals for charity.
Header Specification
To facilitate grading, include in your header comment which portions of the assignment you
have completed. You must complete all portions in order to earn full credit, but partial credit is
available for completing some of the steps. The primary steps are as follows:
(1) Processing Individual Registrations
(2) Processing Team Registrations
(3) Processing the running events
(4) Calculating total donations
If your comment is accurate, meaning that you pass the appropriate tests cases corresponding to
your choice, you'll earn 10 points. If your comment is roughly accurate, meaning that you
sincerely attempted the items you listed, and most of them work minus a tiny bug, then you'll
get 5 of these points. If your comment isn't accurate to a reasonable degree, you'll get 0 of these
points.
The reason this is here is because it's very important to communicate to others accurately what
you've accomplished and what is left to accomplish. This sort of honesty and ability to appraise
your own work is a critical skill in a job.
Program Details
Individual RegistrationDetails
There are a two registration windows: early registration and regular registration. Prices for
registering early and regularly will be given. Each individual will have a unique number and
must be processed separately to record their name, age, running event, and donations raised. The
maximum number of runners for our program will be 10000.
Team RegistrationDetails
Teams may be created and registered to sign up several participators at once. Teams may only
sign up during early registration, have between 5 and 50 members, and must pay the team
registration fee for every member on the team. Teams should be recorded with their name and
number of members. Each member of the team still needs to be recorded with their name, age,
running event, and donations raised. We can organize at most 200 teams.
Running EventsDetails
There will be three running events: a 5k race, a 10k race, and a marathon race. For each race,
your program will receive the running time for each participant in the race. For the 5k and the
10k you should print the runner with the fastest time. For the marathon, your program will need
to check times against the required qualifying times to see which runners qualify for more
marathon races. These qualifying times vary by age group.
Total Donation Details
After all the races are run we want to recognize the participants who raised the most money for
charity. Print the team that raised the most money for the event along with the amount raised.
Then for each team, print the team member who raised the most money along with the amount
raised. For the individuals, print the top individual who raised the most money along with the
amount raised. Finally, print the total amount raised for the event. All donations and registration
fees will be donated directly to charity.
Implementation Restrictions
You must use the following constants:
#define TEAMS 200
#define RUNNERS 10000
#define LENGTH 20
#define TEAMSIZE 50
You must use the following structures to store information:
struct person {
char name[LENGTH];
int number;
int age;
int event;
float money;
float time;
};
struct team {
char name[LENGTH];
int nummembers;
float money;
struct person members[TEAMSIZE];
};
It is not sufficient to simply have the structures in your program, you must use them store
information and process operations for the program.
Though function prototypes will not be provided, it is expected that you follow good
programming design and create several functions with well-specified tasks related to the solution
of this problem. Make sure to pay very careful attention to parameter passing.
Input Specification
The first line of the file contains the following three values, separated by spaces:
Cost of early registration for individuals (in dollars), Cost of regular registration for individuals
(in dollars), and the cost of team registration (in dollars). These will be positive real numbers to
two decimal places.
The second line of the file will contain one positive integer representing the number of early
individuals and teams who are registering. Every registration will start with either TEAM or
INDV for a team registration or individual registration respectively.
Lines that begin with INDV will be followed by four values, separated by spaces:
The individual’s name, their age, their chosen running event, and the amount of
donations they have raised. The first is a string, the second is a positive integer, the third is an
integer from the set {5, 10, 42}, and the fourth is a positive real number.
Lines that begin with TEAM will be followed by two values, separated by spaces: the name of
the team and the number of team members (k). This will be followed by k lines organized the
same as the individual registration above.
After early registration completes, normal registration can begin. This will be represented by one
positive integer (m) representing the number of regular registrations. All teams must use early
registration. This will be followed by m lines each with four values. These are the same values
that are present in individual registration: The team member’s name, their age, their chosen
running event, and the amount of donations they have raised. The first is a string, the second is a
positive integer, the third is an integer from the set {5, 10, 42}, and the fourth is a positive real
number.
After registration, the running events can occur. Every registered participant will be listed with
their number (assigned as part of registration) and the time it took them to run the race in minutes
represented as a real number.
This will be followed by 10 lines of qualifying times based on age groups. They will be
specified:
STARTINGAGE ENDINGAGE TIME
where starting age and ending age are integers, and the qualifying time is a real number
representing minutes.
Output Specification
For an individual registering for an event print a line of the form:
X registered for the Y race! They have been assigned the number Z.
where X is their name and Y is the event they are registering for. Y is represented by an integer
{5, 10, 42} in the input file. Replace it with “5k” for the first integer, “10k” for the second
integer, and “marathon” for the third integer in this print statement. Z is their unique runner
number. These numbers should start at 1 and count up to a max of 10000.
For a team registering print a line with one of the form:
X team registered for the event. They have Y members:
where X is the team name and Y is their number of members. Follow this with Y lines of the
same form as the individuals: one for each member of the team.
For the 5k race and the 10k race, output a single line of the following form:
Xk race: Y had the fastest time with Z.Z minutes!
where X is either 5 or 10 respectively, Y represents the name of the fastest runner and Z
represents their time.
For the marathon race, print out all the runners who times meet the qualifying times:
X qualified in the marathon run with a time of Y.Y minutes!
where X represents the name of the fastest runner and Y represents their time.
For the team that raised the most money, output a single line of the following form:
The X team raised the most money with a team donation of $Y.YY!
where X is the team name and Y is the amount they raised.
For each team, print out the person that raised the most with a single line of the following form:
X raised the most money on team Y with a donation of $Z.ZZ!
where X is the person’s name, Y is the team name, and Z is the amount they raised.
For the individual that raised the most money, output a single line of the following form:
X raised $Y.YY!
where X is the person’s name and Y is the amount they raised.
End with the total amount raised by the event:
The runners raised $X.XX for charity!
Sample Input/Output
Four sets of input and output are provided with the assignment, showing the different portions of
the assignment. You should try to complete race01 first, then proceed to race02, and so forth.
Each test file is labeled as raceXX.txt for input and raceXX.out for output. Out files can be
opened in notepad and other unformatted text editors.
Deliverables
A single source file named charityrun.c turned in through WebCourses.
Restrictions
Although you may use other compilers, your program must compile in gcc and run in
Code::Blocks. Your program should include a header comment with the following information:
your name, course number, section number, assignment title, and date. Make sure you include
comments throughout your code describing the major steps in solving the problem.
Make sure to use good programming style, including use of appropriate constants, good variable
names and good use of white space.
Grading Details
Your programs will be graded upon the following criteria:
1) Your correctness
2) Your programming style and use of white space. Even if you have a plan and your program
works perfectly, if your programming style is poor or your use of white space is poor, you could
get 10% or 15% deducted from your grade.
3) Compatibility – You must submit C source files that can be compiled and executed in a
standard C Development Environment. If your program does not compile, you will get a sizable
deduction from your grade.
4) Header Comment - In your header comment, you must state which portions of the assignment
you have implemented. Your choices are as follows:
(1) Processing Individual Registrations
(2) Processing Team Registrations
(3) Processing run events
(4) Calculating total donations
If your comment is accurate, meaning that you pass the appropriate tests cases corresponding to
your choice, you'll earn 10 points. If your comment is roughly accurate, meaning that you
sincerely attempted the items you listed, and most of them work minus a tiny bug, then you'll
get 5 of these points. If your comment isn't accurate to a reasonable degree, you'll get 0 of these
points.
The reason this is here is because it's very important to communicate to others accurately what
you've accomplished and what is left to accomplish. This sort of honesty and ability to appraise
your own work is a critical skill in a job.
INPUT:
25.5 35.75 21
7
INDV Emily 30 5 10
INDV Karla 27 10 25.6
INDV Martin 45 5 33.75
TEAM OATS 5
Maria 22 5 15.62
Caleb 41 10 20.5
Michael 30 42 18.75
Lily 33 10 31.15
Charlotte 29 5 25.8
INDV Lucas 23 42 100
INDV Hayley 34 42 27.43
TEAM RAINBOW 3
Lawrence 56 5 33.75
David 55 5 30.15
Josie 60 5 13.79
7
George 50 10 90.3
Evelyn 47 5 15.4
Linus 55 10 22.8
Charlie 40 42 150.75
Lucy 24 10 14.89
Leah 42 5 23.45
Thomas 29 5 10.6
1 40
2 75
3 35
4 30
5 80
6 200
7 82
8 32
9 230
10 213
11 37
12 25
13 33
14 78
15 31
16 82
17 235
18 77
19 36
20 29
18 34 215
35 39 220
40 44 225
45 49 235
50 54 240
55 59 250
60 64 265
65 69 280
70 74 295
75 79 310
OUTPUT: Emily registered for the 5k race! They have been assigned the number 1 Karla
registered for the 10k race l They have been assigned the number 2 Martin registered for the 5k
race l They have been assigned the number 3 OATS team registered for the event They have 5
members Maria registered for the 5k race! They have been assigned the number 4 Caleb
registered for the 10k race They have been assigned the number 5 Michael registered for the
marathon race They have been assigned the number 6 Lily registered for the 10k race They have
been assigned the number 7 Charlotte registered for the 5k race They have been assigned the
number 8 Lucas registered for the marathon race They have been assigned the number 9 Hayley
registered for the marathon race! They have been assigned the number 10 RAINBOW team
registered for the event They have 3 members Lawrence registered for the 5k race They have
been assigned the number 11 David registered for the 5k race They have been assigned the
number 12 Josie registered for the 5k race They have been assigned the number 13 George
registered for the 10k race They have been assigned the number 14 Evelyn registered for the 5k
race They have been assigned the number 15 Linus registered for the 10k race They have been
assigned the number 16 Charlie registered for the marathon race They have been assigned the
number 17 Lucy registered for the 10k race They have been assigned the number 18 Leah
registered for the 5k race l They have been assigned the number 19 Thomas registered for the 5k
race I They have been assigned the number 20 5k race: David had the fastest time with 25.0
minutes 10k race Karla had the fastest time with 75.0 minutes Hayley qualified in the marathon
run with a time of 213.0 minutes l Michael qualified in the marathon run with a time of 200.0
minutes l The OATS team raised the most money with a team donation of $111.82 l Lily raised
the most money on team OATS with a donation of $31.15 I Lawrence raised the most money on
team RAINBOW with a donation of $33.75 Charlie raised $150.75 The runners raised $1260.23
for charity!
Solution
#include
#include
#define TEAMS 200
#define RUNNERS 10000
#define LENGTH 20
#define TEAMSIZE 50
//creating person structure
struct person {
char type[4];
char name[LENGTH];
int number;
int age;
int event;
float money;
float time;
};
//creatind team structure
struct team {
char name[LENGTH];
int numbers;
float money;
struct person *members;
};
//declaring team and person structures
struct person persons[1000];
struct team teams[200];
int per_size=0;
int t_size=0,i=0;
//regiserting a person
void registerPerson(struct person p){
if(RUNNERS!=per_size){
p.number=per_size;
(persons)[per_size]=p;
per_size=per_size+1;
printf(" %s register for the %dk race.They have been assigned with %d
number",p.name,p.event,p.number);
}
else{
printf("maximum runners reached");
return;
}
}
//register a team
void registerTeam(struct team t){
if(t_size>=5 && t_size<=TEAMSIZE){
teams[t_size]=t;
t_size=t_size+1;
printf(" The %s team register for the event.THey have %d members",t.name,t.numbers);
}
else{
printf("maximum team reached");
return;
}
}
void race5k_calc(){
int i=0;
struct person p;
//calculate for individual persons
for(i=0;ipersons[i+1].time) )
{
p=persons[i+1];
}
}
}
printf(" 5K RACE: %s has the fastest time with %f minutes",p.name,p.time);
}
void race10k_calc(){
int i=0;
struct person p;
//checking person event is 10k run and finding the winner
for(i=0;ipersons[i+1].time) )
{
p=persons[i+1];
}
}
}
printf(" 10K RACE: %s has the fastest time with %f minutes",p.name,p.time);
}
void race_marathon_calc(){
int i=0;
int hrs,mts,secs;
struct person p;
//checking persons event is marathon and finding winner
for(i=0;ipersons[i+1].time) )
{
p=persons[i+1];
}
}
}
printf("marathon RACE: %s has the fastest time with %f minutes",p.name,p.time);
}
//calculating the donation
void donation_calc(){
float amt=0,t_amt=0,max_amt=0;
struct person p,*members;
struct team t;
int i=0,j=0,l;
for(i=0;imembers[j].money){
max_amt=members[j].money;
p=members[j];
}
printf(" %s raised the mostmoney on the %s team with $%f
amount",p.name,max_amt);
t_amt=t_amt+members[j].money;
printf(" The %s team raised the most money $%f ",t.name,t_amt);
}
}
amt=0;
for(i=0;i

More Related Content

PDF
{c}Problem Run For Charity (charityrun.c)Charity Runs are a pop.pdf
PDF
June 03 P2
DOCX
Student Lab Activity A. Lab # CIS CIS170A-A1B. Lab.docx
DOCX
COMPUTER SCIENCE INVESTIGATORY PROJECT ON FOOTBALL GAME AND SCORE MANAGEMENT ...
PDF
A Project Based Lab Report On AMUZING JOKE
PDF
Acm aleppo cpc training introduction 1
PDF
C - Programming Assignment 1 and 2
PDF
Acm aleppo cpc training second session
{c}Problem Run For Charity (charityrun.c)Charity Runs are a pop.pdf
June 03 P2
Student Lab Activity A. Lab # CIS CIS170A-A1B. Lab.docx
COMPUTER SCIENCE INVESTIGATORY PROJECT ON FOOTBALL GAME AND SCORE MANAGEMENT ...
A Project Based Lab Report On AMUZING JOKE
Acm aleppo cpc training introduction 1
C - Programming Assignment 1 and 2
Acm aleppo cpc training second session

Similar to Any kind of help would gladly be appreciated. (C-programming)Probl.pdf (20)

PDF
Introduction to Basic C++ Program Examples .pdf
PPTX
First game using c language
PPT
Acm icpc-briefing-prof-nbv
PPTX
Summer Training Project.pptx
PPTX
c programming session 1.pptx
DOCX
COMP 2103X1 Assignment 2Due Thursday, January 26 by 700 PM.docx
DOCX
Senior project proposal
PDF
Basic Concepts of Programming - Practical Exercises
DOCX
Senior project proposal
DOCX
Strengths-based nursing (SBN) is an approach to care in which eigh.docx
PDF
Workshop on programming contest
DOC
Lab sheet 1
DOC
C notes by m v b reddy(gitam)imp notes all units notes 5 unit order
PPTX
COMPUTER SCIENCE PRE RELEASE 2210 FOR NOVEMBER 2018 P22
PDF
Cp module 2
PPT
2008 RRM Relay Presentation
PDF
IP Lab Manual for Kerala University 3 Year UG Programme
PPS
Learn C
PDF
Book management system
DOC
Datastructure notes
Introduction to Basic C++ Program Examples .pdf
First game using c language
Acm icpc-briefing-prof-nbv
Summer Training Project.pptx
c programming session 1.pptx
COMP 2103X1 Assignment 2Due Thursday, January 26 by 700 PM.docx
Senior project proposal
Basic Concepts of Programming - Practical Exercises
Senior project proposal
Strengths-based nursing (SBN) is an approach to care in which eigh.docx
Workshop on programming contest
Lab sheet 1
C notes by m v b reddy(gitam)imp notes all units notes 5 unit order
COMPUTER SCIENCE PRE RELEASE 2210 FOR NOVEMBER 2018 P22
Cp module 2
2008 RRM Relay Presentation
IP Lab Manual for Kerala University 3 Year UG Programme
Learn C
Book management system
Datastructure notes
Ad

More from sktambifortune (20)

PDF
Your company is preparing to migrate from IPv4 to IPv6, and you are .pdf
PDF
You are burning the latest song you bought on ITunes to a disk. The .pdf
PDF
CASE 3-12 Information System Project Steering Committee The Informat.pdf
PDF
Can you date the latest financial crisis in the United States or in .pdf
PDF
B1. State the components of organization. Give good examples to justi.pdf
PDF
Assignment of SOS operating systemThe file lmemman.c has one incom.pdf
PDF
Which of the following solutions will turn red litmus blue pOH 1.pdf
PDF
What serves as the most reliable source of information about the .pdf
PDF
What is the difference between the terms “earnings and profits” and .pdf
PDF
what are three effects of transistor scaling on computer architectur.pdf
PDF
What are some of the motives for employee theft What are some .pdf
PDF
Twitter is a popular social media. It allows its users to exchange tw.pdf
PDF
A. State the domai and ranga. 1. y find the inverse and state the dom.pdf
PDF
The Puritan faith community shaped the New England colonies in virtu.pdf
PDF
savings account d. the value of the shares is based on the amount of .pdf
PDF
QuestionIt was reported on June 11, 1997, by NBC Nightly News that.pdf
PDF
946 LTE Labs Le.chateliers-lab.pdf Before beginning this experiment.pdf
PDF
Prove that the T_i-property is a topological property for i = 0So.pdf
PDF
4. Refer to the table of Gini coefficients in the Added Dimension box.pdf
PDF
number of lines should be included in the last page of the paper aft.pdf
Your company is preparing to migrate from IPv4 to IPv6, and you are .pdf
You are burning the latest song you bought on ITunes to a disk. The .pdf
CASE 3-12 Information System Project Steering Committee The Informat.pdf
Can you date the latest financial crisis in the United States or in .pdf
B1. State the components of organization. Give good examples to justi.pdf
Assignment of SOS operating systemThe file lmemman.c has one incom.pdf
Which of the following solutions will turn red litmus blue pOH 1.pdf
What serves as the most reliable source of information about the .pdf
What is the difference between the terms “earnings and profits” and .pdf
what are three effects of transistor scaling on computer architectur.pdf
What are some of the motives for employee theft What are some .pdf
Twitter is a popular social media. It allows its users to exchange tw.pdf
A. State the domai and ranga. 1. y find the inverse and state the dom.pdf
The Puritan faith community shaped the New England colonies in virtu.pdf
savings account d. the value of the shares is based on the amount of .pdf
QuestionIt was reported on June 11, 1997, by NBC Nightly News that.pdf
946 LTE Labs Le.chateliers-lab.pdf Before beginning this experiment.pdf
Prove that the T_i-property is a topological property for i = 0So.pdf
4. Refer to the table of Gini coefficients in the Added Dimension box.pdf
number of lines should be included in the last page of the paper aft.pdf
Ad

Recently uploaded (20)

PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
Institutional Correction lecture only . . .
PDF
A systematic review of self-coping strategies used by university students to ...
PPTX
Lesson notes of climatology university.
PDF
Classroom Observation Tools for Teachers
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Complications of Minimal Access Surgery at WLH
PPTX
Presentation on HIE in infants and its manifestations
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Microbial disease of the cardiovascular and lymphatic systems
Supply Chain Operations Speaking Notes -ICLT Program
102 student loan defaulters named and shamed – Is someone you know on the list?
Institutional Correction lecture only . . .
A systematic review of self-coping strategies used by university students to ...
Lesson notes of climatology university.
Classroom Observation Tools for Teachers
Final Presentation General Medicine 03-08-2024.pptx
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
O7-L3 Supply Chain Operations - ICLT Program
Complications of Minimal Access Surgery at WLH
Presentation on HIE in infants and its manifestations
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Abdominal Access Techniques with Prof. Dr. R K Mishra
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
human mycosis Human fungal infections are called human mycosis..pptx
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
Microbial diseases, their pathogenesis and prophylaxis
Microbial disease of the cardiovascular and lymphatic systems

Any kind of help would gladly be appreciated. (C-programming)Probl.pdf

  • 1. Any kind of help would gladly be appreciated. (C-programming) Problem: Charity Runs are a popular way for organizations to raise awareness and get fit at the same time. However, these events can be tough to organize. The Princess Half Marathon Weekend, for example, has as many as 40,000 runners raising money and awareness for the Children’s Miracle Network Hospitals. People can run both 5ks and 10ks and there’s even a children’s race. After nearly a semester of C programming, you've decided that you'd like to donate your skills to create a program that organizes the typical activities for charity run weekend. In particular, your program will help manage the following: 1) Individual Registration 2) Team Registration 3) Running Events 4) Donation Totals Your program will log the number of teams and individual who are signed up for the different races, process the racing events to see who has the fastest times, and track the total amount of money raised by teams and individuals for charity. Header Specification To facilitate grading, include in your header comment which portions of the assignment you have completed. You must complete all portions in order to earn full credit, but partial credit is available for completing some of the steps. The primary steps are as follows: (1) Processing Individual Registrations (2) Processing Team Registrations (3) Processing the running events (4) Calculating total donations If your comment is accurate, meaning that you pass the appropriate tests cases corresponding to your choice, you'll earn 10 points. If your comment is roughly accurate, meaning that you sincerely attempted the items you listed, and most of them work minus a tiny bug, then you'll get 5 of these points. If your comment isn't accurate to a reasonable degree, you'll get 0 of these points. The reason this is here is because it's very important to communicate to others accurately what you've accomplished and what is left to accomplish. This sort of honesty and ability to appraise your own work is a critical skill in a job. Program Details Individual RegistrationDetails There are a two registration windows: early registration and regular registration. Prices for
  • 2. registering early and regularly will be given. Each individual will have a unique number and must be processed separately to record their name, age, running event, and donations raised. The maximum number of runners for our program will be 10000. Team RegistrationDetails Teams may be created and registered to sign up several participators at once. Teams may only sign up during early registration, have between 5 and 50 members, and must pay the team registration fee for every member on the team. Teams should be recorded with their name and number of members. Each member of the team still needs to be recorded with their name, age, running event, and donations raised. We can organize at most 200 teams. Running EventsDetails There will be three running events: a 5k race, a 10k race, and a marathon race. For each race, your program will receive the running time for each participant in the race. For the 5k and the 10k you should print the runner with the fastest time. For the marathon, your program will need to check times against the required qualifying times to see which runners qualify for more marathon races. These qualifying times vary by age group. Total Donation Details After all the races are run we want to recognize the participants who raised the most money for charity. Print the team that raised the most money for the event along with the amount raised. Then for each team, print the team member who raised the most money along with the amount raised. For the individuals, print the top individual who raised the most money along with the amount raised. Finally, print the total amount raised for the event. All donations and registration fees will be donated directly to charity. Implementation Restrictions You must use the following constants: #define TEAMS 200 #define RUNNERS 10000 #define LENGTH 20 #define TEAMSIZE 50 You must use the following structures to store information: struct person { char name[LENGTH]; int number; int age; int event; float money; float time;
  • 3. }; struct team { char name[LENGTH]; int nummembers; float money; struct person members[TEAMSIZE]; }; It is not sufficient to simply have the structures in your program, you must use them store information and process operations for the program. Though function prototypes will not be provided, it is expected that you follow good programming design and create several functions with well-specified tasks related to the solution of this problem. Make sure to pay very careful attention to parameter passing. Input Specification The first line of the file contains the following three values, separated by spaces: Cost of early registration for individuals (in dollars), Cost of regular registration for individuals (in dollars), and the cost of team registration (in dollars). These will be positive real numbers to two decimal places. The second line of the file will contain one positive integer representing the number of early individuals and teams who are registering. Every registration will start with either TEAM or INDV for a team registration or individual registration respectively. Lines that begin with INDV will be followed by four values, separated by spaces: The individual’s name, their age, their chosen running event, and the amount of donations they have raised. The first is a string, the second is a positive integer, the third is an integer from the set {5, 10, 42}, and the fourth is a positive real number. Lines that begin with TEAM will be followed by two values, separated by spaces: the name of the team and the number of team members (k). This will be followed by k lines organized the same as the individual registration above. After early registration completes, normal registration can begin. This will be represented by one positive integer (m) representing the number of regular registrations. All teams must use early registration. This will be followed by m lines each with four values. These are the same values that are present in individual registration: The team member’s name, their age, their chosen running event, and the amount of donations they have raised. The first is a string, the second is a positive integer, the third is an integer from the set {5, 10, 42}, and the fourth is a positive real number. After registration, the running events can occur. Every registered participant will be listed with
  • 4. their number (assigned as part of registration) and the time it took them to run the race in minutes represented as a real number. This will be followed by 10 lines of qualifying times based on age groups. They will be specified: STARTINGAGE ENDINGAGE TIME where starting age and ending age are integers, and the qualifying time is a real number representing minutes. Output Specification For an individual registering for an event print a line of the form: X registered for the Y race! They have been assigned the number Z. where X is their name and Y is the event they are registering for. Y is represented by an integer {5, 10, 42} in the input file. Replace it with “5k” for the first integer, “10k” for the second integer, and “marathon” for the third integer in this print statement. Z is their unique runner number. These numbers should start at 1 and count up to a max of 10000. For a team registering print a line with one of the form: X team registered for the event. They have Y members: where X is the team name and Y is their number of members. Follow this with Y lines of the same form as the individuals: one for each member of the team. For the 5k race and the 10k race, output a single line of the following form: Xk race: Y had the fastest time with Z.Z minutes! where X is either 5 or 10 respectively, Y represents the name of the fastest runner and Z represents their time. For the marathon race, print out all the runners who times meet the qualifying times: X qualified in the marathon run with a time of Y.Y minutes! where X represents the name of the fastest runner and Y represents their time. For the team that raised the most money, output a single line of the following form: The X team raised the most money with a team donation of $Y.YY! where X is the team name and Y is the amount they raised. For each team, print out the person that raised the most with a single line of the following form: X raised the most money on team Y with a donation of $Z.ZZ! where X is the person’s name, Y is the team name, and Z is the amount they raised. For the individual that raised the most money, output a single line of the following form: X raised $Y.YY! where X is the person’s name and Y is the amount they raised. End with the total amount raised by the event: The runners raised $X.XX for charity!
  • 5. Sample Input/Output Four sets of input and output are provided with the assignment, showing the different portions of the assignment. You should try to complete race01 first, then proceed to race02, and so forth. Each test file is labeled as raceXX.txt for input and raceXX.out for output. Out files can be opened in notepad and other unformatted text editors. Deliverables A single source file named charityrun.c turned in through WebCourses. Restrictions Although you may use other compilers, your program must compile in gcc and run in Code::Blocks. Your program should include a header comment with the following information: your name, course number, section number, assignment title, and date. Make sure you include comments throughout your code describing the major steps in solving the problem. Make sure to use good programming style, including use of appropriate constants, good variable names and good use of white space. Grading Details Your programs will be graded upon the following criteria: 1) Your correctness 2) Your programming style and use of white space. Even if you have a plan and your program works perfectly, if your programming style is poor or your use of white space is poor, you could get 10% or 15% deducted from your grade. 3) Compatibility – You must submit C source files that can be compiled and executed in a standard C Development Environment. If your program does not compile, you will get a sizable deduction from your grade. 4) Header Comment - In your header comment, you must state which portions of the assignment you have implemented. Your choices are as follows: (1) Processing Individual Registrations (2) Processing Team Registrations (3) Processing run events (4) Calculating total donations If your comment is accurate, meaning that you pass the appropriate tests cases corresponding to your choice, you'll earn 10 points. If your comment is roughly accurate, meaning that you sincerely attempted the items you listed, and most of them work minus a tiny bug, then you'll get 5 of these points. If your comment isn't accurate to a reasonable degree, you'll get 0 of these points. The reason this is here is because it's very important to communicate to others accurately what you've accomplished and what is left to accomplish. This sort of honesty and ability to appraise
  • 6. your own work is a critical skill in a job. INPUT: 25.5 35.75 21 7 INDV Emily 30 5 10 INDV Karla 27 10 25.6 INDV Martin 45 5 33.75 TEAM OATS 5 Maria 22 5 15.62 Caleb 41 10 20.5 Michael 30 42 18.75 Lily 33 10 31.15 Charlotte 29 5 25.8 INDV Lucas 23 42 100 INDV Hayley 34 42 27.43 TEAM RAINBOW 3 Lawrence 56 5 33.75 David 55 5 30.15 Josie 60 5 13.79 7 George 50 10 90.3 Evelyn 47 5 15.4 Linus 55 10 22.8 Charlie 40 42 150.75 Lucy 24 10 14.89 Leah 42 5 23.45 Thomas 29 5 10.6 1 40 2 75 3 35 4 30 5 80 6 200 7 82 8 32 9 230
  • 7. 10 213 11 37 12 25 13 33 14 78 15 31 16 82 17 235 18 77 19 36 20 29 18 34 215 35 39 220 40 44 225 45 49 235 50 54 240 55 59 250 60 64 265 65 69 280 70 74 295 75 79 310 OUTPUT: Emily registered for the 5k race! They have been assigned the number 1 Karla registered for the 10k race l They have been assigned the number 2 Martin registered for the 5k race l They have been assigned the number 3 OATS team registered for the event They have 5 members Maria registered for the 5k race! They have been assigned the number 4 Caleb registered for the 10k race They have been assigned the number 5 Michael registered for the marathon race They have been assigned the number 6 Lily registered for the 10k race They have been assigned the number 7 Charlotte registered for the 5k race They have been assigned the number 8 Lucas registered for the marathon race They have been assigned the number 9 Hayley registered for the marathon race! They have been assigned the number 10 RAINBOW team registered for the event They have 3 members Lawrence registered for the 5k race They have been assigned the number 11 David registered for the 5k race They have been assigned the number 12 Josie registered for the 5k race They have been assigned the number 13 George registered for the 10k race They have been assigned the number 14 Evelyn registered for the 5k race They have been assigned the number 15 Linus registered for the 10k race They have been assigned the number 16 Charlie registered for the marathon race They have been assigned the
  • 8. number 17 Lucy registered for the 10k race They have been assigned the number 18 Leah registered for the 5k race l They have been assigned the number 19 Thomas registered for the 5k race I They have been assigned the number 20 5k race: David had the fastest time with 25.0 minutes 10k race Karla had the fastest time with 75.0 minutes Hayley qualified in the marathon run with a time of 213.0 minutes l Michael qualified in the marathon run with a time of 200.0 minutes l The OATS team raised the most money with a team donation of $111.82 l Lily raised the most money on team OATS with a donation of $31.15 I Lawrence raised the most money on team RAINBOW with a donation of $33.75 Charlie raised $150.75 The runners raised $1260.23 for charity! Solution #include #include #define TEAMS 200 #define RUNNERS 10000 #define LENGTH 20 #define TEAMSIZE 50 //creating person structure struct person { char type[4]; char name[LENGTH]; int number; int age; int event; float money; float time; }; //creatind team structure struct team { char name[LENGTH]; int numbers; float money; struct person *members; };
  • 9. //declaring team and person structures struct person persons[1000]; struct team teams[200]; int per_size=0; int t_size=0,i=0; //regiserting a person void registerPerson(struct person p){ if(RUNNERS!=per_size){ p.number=per_size; (persons)[per_size]=p; per_size=per_size+1; printf(" %s register for the %dk race.They have been assigned with %d number",p.name,p.event,p.number); } else{ printf("maximum runners reached"); return; } } //register a team void registerTeam(struct team t){ if(t_size>=5 && t_size<=TEAMSIZE){ teams[t_size]=t; t_size=t_size+1; printf(" The %s team register for the event.THey have %d members",t.name,t.numbers); } else{ printf("maximum team reached"); return; } } void race5k_calc(){ int i=0; struct person p; //calculate for individual persons
  • 10. for(i=0;ipersons[i+1].time) ) { p=persons[i+1]; } } } printf(" 5K RACE: %s has the fastest time with %f minutes",p.name,p.time); } void race10k_calc(){ int i=0; struct person p; //checking person event is 10k run and finding the winner for(i=0;ipersons[i+1].time) ) { p=persons[i+1]; } } } printf(" 10K RACE: %s has the fastest time with %f minutes",p.name,p.time); } void race_marathon_calc(){ int i=0; int hrs,mts,secs; struct person p; //checking persons event is marathon and finding winner for(i=0;ipersons[i+1].time) ) { p=persons[i+1]; } } } printf("marathon RACE: %s has the fastest time with %f minutes",p.name,p.time); } //calculating the donation void donation_calc(){ float amt=0,t_amt=0,max_amt=0;
  • 11. struct person p,*members; struct team t; int i=0,j=0,l; for(i=0;imembers[j].money){ max_amt=members[j].money; p=members[j]; } printf(" %s raised the mostmoney on the %s team with $%f amount",p.name,max_amt); t_amt=t_amt+members[j].money; printf(" The %s team raised the most money $%f ",t.name,t_amt); } } amt=0; for(i=0;i