Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QUESTION 1 A telematch event has been held in Sekolah Rendah Tebing Tinggi. Three teams are allowed to participate in this match, with each team

image text in transcribedimage text in transcribedimage text in transcribed

QUESTION 1 A telematch event has been held in Sekolah Rendah Tebing Tinggi. Three teams are allowed to participate in this match, with each team consisting of four participants. Five (5) events were contested, namely E1, E2, E3, E4 and ES. Table 1 shows the scores that have been collected by each team for the five events. Write a C++ program that can assist the telematch committee to determine the winner for these events. Your program should be able to do the following tasks: a) The program will read input data: team D. participant D. and scores for the five events namely E1, E2, E3, E4, and E5 from an input file named input2.txt" into an antay marks [12]7] of type int. An example of the series of input data in the input file is shown in Figure 1. b) The program must be able to notify the user if the input file cannot be opened (failed to open) with the proper prompt. The example for user notification where the file fails to open is shown in Figwe 2. c) Calculate the total score for each participant Table 1: Collected scores Team ID Participant ID El E2 E3 E4 E5 10 8 10 6 1001 1002 5 7 8 10 9 1 7 10 10 6 10 1003 1004 10 10 8 7 7 LMY 2021 1 2001 7 8 10 9 10 2002 10 8 7 8 2 Jele 2003 8 6 8 8 2004 7 8 8 8 8 3001 10 9 10 10 10 8 8 8 8 3 3002 3003 7 8 7 9 10 6 3004 8 6 8 7 7 1 1001 10 5 8 10 6 1 1002 8 7 10 7 9 1 1003 7 10 10 6 10 1 1004 10 10 8 77 2 2001 7 8 10 9 10 2 2002 10 8 7 8 10 2 2003 8 6 8 8 10 2 2004 7 8 8 8 8 3 3001 10 9 10 10 10 3 3002 8 7 8 8 8 3 3003 7 8 9 10 6 3 3004 8 687 Figure 1: Input file named "input2.txt" Sorry, input file does not exist! Press any key to continue. Figure 2: Example user notification in case file fails to open d) Calculate the total score for each team. e) Besides the function main(), the program needs to define three (3) other functions as described in Table 2. Use appropriate argument (if necessary) for each function. Function displaytine) findIndwinner Table 2: Description for functions Description To display lines using the 52 characters of the function should use loop to display the line To determine the winner for individual category selected based on the highest total score that was collected by participants). The function should accept the array for a total score of each participant as one of its argument. To determine the winner of group Category (selected based on the highest total score that was collected by teams). The function should accept the array for a total score for each team as one of its argument. findTeamwinner 1) The program needs to print out the following information Figure 3 shows the example, run of the successful program. The team D The participant D. The scores for the five events, E1, E2, E3, E4 and E5 for each participant. The total score for each participant . The total score for each team The winner for individual category (selected based on highest total score that collected by the participants). The winner for group category (selected based on highest total score that collected by the teams). Id E1 E4 ES Total 10 10 7 9 TEAM 1 1001 1002 1003 1004 TOTAL 5 7 10 10 10 10 2 10 7 39 41 43 42 165 10 7 9 TEZOH 2 2001 2002 2003 2004 TOTAL 7 10 B 8 8 8 6 8 10 7 8 8 10 10 10 8 40 B 166 9 10 TEK 3001 3002 3003 3004 TOTAL 10 B 7 8 7 8 6 10 8 9 8 10 B 10 7 49 39 40 7 164 Winner for Individual Category: 3001 (Tean 3) Winner for Group Category: Team 2 (Score = 166) Press any key to continue... Figure 3: Output of the program

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

More Books

Students also viewed these Databases questions

Question

=+j Improve the effectiveness of global and virtual teams.

Answered: 1 week ago