Question

In: Computer Science

Case Study for Question 3 and 4 The Georgetown Heritage club is organizing a running competition....

Case Study for Question 3 and 4

The Georgetown Heritage club is organizing a running competition. All participants are
required to run 3 races: 400m, 200m, and 100m sprints. The sports club requires a system to
record the performance times of all participants for each of the 3 running events. The sports
club also wants to record the registration number and the age of each participant.

Requirement 1: The user must be prompted to input data for each participant in the correct
format up to a maximum of 40 participants. If the format is incorrect, the user must be asked
to re-enter the data. For reasons of simplicity you may assume that all times are recorded as
whole numbers (number of seconds). The user must be able to indicate when data entry for
the last participant has been completed.

Requirement 2: Based on the available data, the organizers want the system to identify:

 The registration number of the fastest runner for each race
 For each race, the average time needed by all those participants who are aged 60 and
above.
 The algorithm must be able to perform these calculations and inform the user of the
results.

Question 3


Write an algorithm based on the description above that satisfies Requirement 1 and
Requirement 2.


Any interaction with the user should be represented as appropriate display messages.
[25 marks]

Solutions

Expert Solution

Algorithm

Step 1: Declare MAX_SIZE = 40 and numOfEntries = 0

Step 2: Declare array for registrationNums with size MAX_SIZE

step 3: Declare four arrays for ages, scoresRace1, scoresReace2 and scoresRace3 with size MAX_SIZE

Step 4: Prompt to the user to enter registration number of participant and read it to registrationNumber

Step 5: Check the registrationNumber is valid or not. If not valid, print the error message "Registration number is not valid" and go to step 4.

Step 6: Prompt to the user to enter age of participant and read it to age

Step 7: Check the age is valid or not. If not valid, print the error message "Age is not valid" and go to step 6.

Step 8: Prompt to the user to enter time of race1 of participant and read it to race1

Step 9: Check the race1 is valid or not. If not valid, print the error message "Score is not valid" and go to step 8.

Step 10: Prompt to the user to enter time of race2 of participant and read it to race2

Step 11: Check the race2 is valid or not. If not valid, print the error message "Score is not valid" and go to step 10.

Step 12: Prompt to the user to enter time of race3 of participant and read it to race3

Step 13: Check the race3 is valid or not. If not valid, print the error message "Score is not valid" and go to step 12.

Step 14: registrationNums[numOfEntries] = registrationNumber

ages[numOfEntries] = age

scoresRace1[numOfEntries] = race1

scoresRace2[numOfEntries] = race2

scoresRace3[numOfEntries] = race3

numOfEntries = numOfEntries + 1

Step 15: if numOfEntries is equal to MAX_SIZE go to step 18

Step 16: Ask the user "Do you want to add another entery(Y/N)? and read the answer to answer.

Step 17: If the answer is 'Y', go to step 4. Else if the answer is not 'N' print error message "Invalid answer" and go to step 16.

Step 18: Make race1FastestRunner = race2FastestRunner = race3FastestRunner = 0

race1Sum = race2Sum = race3Sum = 0

count = 0

i = 0

Step 19: If i equal to numOfEntries go to Step 24.

Step 20: if race1[i] > race1[race1FastestRunner], make race1FastestRunner = i

Step 21: if race2[i] > race2[race2FastestRunner], make race2FastestRunner = i

Step 22: if race3[i] > race3[race1FastestRunner], make race3FastestRunner = i

Step 23: if ages[i] >= 60, then make

count = count+1

race1Sum = race1Sum+race1[i]

race2Sum = race2Sum+race2[i]

race3Sum = race3Sum+race3[i]

Step 23: Go to step 19

Step 24: If numOfEntries>0 then, print

The registration number of the fastest runner for race1 = registrationNums[race1FastestRunner]

The registration number of the fastest runner for race2 = registrationNums[race2FastestRunner]

The registration number of the fastest runner for race3 = registrationNums[race3FastestRunner]

The average time needed by participants aged 60 and above for race1 = race1Sum/count

The average time needed by participants aged 60 and above for race2 = race2Sum/count

The average time needed by participants aged 60 and above for race3 = race3Sum/count

Step 25: END


Related Solutions

QUESTION 4 CASE STUDY Read the following case study and then answer the questions. A market...
QUESTION 4 CASE STUDY Read the following case study and then answer the questions. A market darling falls to Earth: The EOH Meltdown Background EOH was listed on the JSE in 1997. Over the next twenty years it grew to one of the largest technology businesses on the African continent. By 2017 it operated in 36 countries in Africa and internationally. It had grown its annual turnover to R15,4 bn rand and was generally viewed as a highly successful company....
Question-Case Study:                                        
Question-Case Study:                                                                                Read the following case study carefully and answer the questions given at the END. . Playing Monopoly: Microsoft The success of Bill Gates together with his company Microsoft and the most favors Windows computer operating systems that are still dominating the PC operating system market has always been an excellent example stimulating the youths in the It industry to follow. But the business success and seemingly amazing technology innovation should not be very strong reasons why the...
CASE STUDY: WEARABLE TECHNOLOGY COMPETITION PROJECT Case Study Information This year, a symposium of wearable technology...
CASE STUDY: WEARABLE TECHNOLOGY COMPETITION PROJECT Case Study Information This year, a symposium of wearable technology manufacturers are sponsoring a contest. The contest is open to anyone who wants to participate. Because of new technological advances in wearable technology, manufacturers are looking for new and innovative product and software solutions. Sarah is a senior student in the engineering technology program at Sheridan, and she is very interested in wearable technology production and supporting applications. She is very interested in everything...
Case Study #27 100 Case Studies in Pathiphysiology (BRUYERE) Patient Case Question 3. Why might the...
Case Study #27 100 Case Studies in Pathiphysiology (BRUYERE) Patient Case Question 3. Why might the healthcare provider have inquired about possible shortness of breath or chest pain with exercise?
Question 31 31) Pure competition (of which perfect competition is a special case) is the only...
Question 31 31) Pure competition (of which perfect competition is a special case) is the only efficient market structure because: a. society gets the amount of the good or service they want b. society gets the good or service at the lowest possible price c. firms are price makers d. both (a) and (b). 3 points Question 32 32) In monopolistic competition: a, all firms produce the same or a similiar good or service b. society gets the amounts of...
Edited****There is not a case study. This is the question in the text.********* This question is...
Edited****There is not a case study. This is the question in the text.********* This question is in reference to the healthcare industry. Briefly describe what happens to each of the following as volume increases. Assume all values stay within their relevant range. Total fixed cost? Total variable cost? Fixed cost per unit? Variable cost per unit? Explain the relationship between step-fixed costs and the relevant range. References would be a bonus! This question is found on page 448 in Financial...
Case Study 04: Geeta Rani is the treasurer of a local gymnastics club. As treasurer she...
Case Study 04: Geeta Rani is the treasurer of a local gymnastics club. As treasurer she is required to identify invoices for payment, prepare the cheque and in conjunction with the president sign the cheques, mail the cheque and update customer accounts. Required: a) Explain the weaknesses in the Accounting Information System that are not protecting Geeta in carrying out her duties. b) The process of reviewing the recording procedures for an Accounting Information system should include three areas. What...
Case study Jun-Wei Yu is a 25-year-old man of Chinese heritage with Down Syndrome. He lives...
Case study Jun-Wei Yu is a 25-year-old man of Chinese heritage with Down Syndrome. He lives in a group home supported by personal care workers, employed by a large disability support organisation. Jun-Wei is able to do some of his personal care tasks with prompting. He can shower himself with reminders about proper washing and with assistance to dry his back, feet and hair; he can brush his own teeth, but also needs to be reminded to do this. With...
Case study Jun-Wei Yu is a 25-year-old man of Chinese heritage with Down Syndrome. He lives...
Case study Jun-Wei Yu is a 25-year-old man of Chinese heritage with Down Syndrome. He lives in a group home supported by personal care workers, employed by a large disability support organisation. Jun-Wei is able to do some of his personal care tasks with prompting. He can shower himself with reminders about proper washing and with assistance to dry his back, feet and hair; he can brush his own teeth, but also needs to be reminded to do this. With...
Case 3 Antiock Hardware: An Inventory Case Study This case study presents a scenario where an...
Case 3 Antiock Hardware: An Inventory Case Study This case study presents a scenario where an error in the inventory valuation, that may prove to be significant, was found by the external auditor of a large wholesale hardware distributor during the course of their audit. Since the objective of all audit clients is to obtain an unqualified opinion, the case focuses on the ability of the client to correct the error to the extent possible and the procedures the external...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT