Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Here is a video that explains this assignment: https://www.youtube.com/watch?v=f2zSkuE8GKA&t=253s C* project2.cpp * x + ... * project2.cpp #include #include W #include 4 #include 6 using

Here is a video that explains this assignment: https://www.youtube.com/watch?v=f2zSkuE8GKA&t=253s

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed
C* project2.cpp * x + ... * project2.cpp #include #include W #include 4 #include 6 using namespace std; 7 int get_data_average( int num[I, double average ) ; 8 void print_result(int id[l, double average[l, int size); 9 void ssort(double x[l, int n) ; 10 11 int main ( ) 12 13 const int MAX TEAMS = 30; 14 int racer_num [MAX_TEAMS ] = (0) ; 15 double average [MAX_TEAMS ] = {0}; 16 int num_of_teams ;Sample Run A sample run of your program might look like this. Note that the user's inputs are highlighted in bold. Enter an input file: pumpkintoss. txt Collegiate Pumpkin Toss Results 2022 Team # Avg. Distance 14 5. 17 meters 15 5.71 meters 17 Disqualified 12 5.28 meters 11 Disqualified First Place: Team 15 (Avg. Dist: 5.71 m) Number of Qualified Teams: 3 Number of Disqualified Teams: 2The CPTI invites different community colleges to compete as teams to try to toss pumpkins as far as possible. Each school is assigned a team number and is given 8 attempts to throw it. You can use any technique you'd like, but the average is taken to determine which team is the winner. You will need to determine each team's average toss distance (in meters) and identify the first place team. An input file with team information contains records of all the tosses completed by each team. Each record begin with the team number and is followed by the 8 distances for each toss. They average is calculated like so: 1. Each team's lowest two distances are discarded before the average is calculated. 2. Any team that has a distance recorded as a negative number means that the team was disqualified (so no average will be displayed). Your program also needs to determine the numbers of qualified and disqualified teams. Your program will begin by asking the user for the input file name first and then it will read the data into your program. After that, calculate the average distances for each team. Furthermore, your program has to determine the first-place team. If two or more teams have the exact same best toss, you have to display all of them as the first-place finishers. You may assume that the total number of teams entered into the invitational will not be greater than 30. Sample Input File The following shows a sample input data file. The first line has the number of teams. Each line indicates the team's number and 8 distances. 5 14 5.6 6.2 3.6 4.5 5.5 4.56 3.75 4.65 15 4.9 5.5 4.8 5.75 4.6 5.6 6.2 6.3 17 5.6 6.2 3.6 -4.5 4.6 5.6 6.2 6.3 4.7 8.5 2.6 3.4 5.5 4.56 3.75 4.65 11 5.6 6.2 3.6 -5 -7 4.56 3.75 4.65(1) Test case 1: 1 1000 10.0 10.0 10.0 10.0 10.0 10.0 10.0 10.0 Execution Result Enter an input file name: t1 . txt Collegiate Pumpkin Toss Results 2022 Team # Avg. Distance 1000 10.00 meters First Place: Team 1000 (Avg. Dist: 10.00 m) Num. of Qualified Teams: 1 Num. of Disqualified Teams: 0 (2) Test case 2: 3 3000 10.0 10.0 10.0 10.0 10.0 10.0 10.0 10.0 1000 9.5 9.5 9.5 9.5 9.5 9.5 9.5 9.5 2020 20.0 20.0 20.0 20.0 20.0 20.0 20.0 20.0 Execution Result Collegiate Pumpkin Toss Results 2022 Team # Avg. Distance 3000 10.00 meters 1000 9.50 meters 2020 20.00 meters First Place: Team 2020 (Avg. Dist: 20.00 m) Num. of Qualified Teams: 3 Num. of Disqualified Teams: 0(3) Test case 3: 3 1000 9.5 9.5 9.5 9 9.5 9.5 9.5 9.5 9.5 5050 10.0 10.0 10.0 10.0 10.0 10.0 10.0 10.0 1001 10.0 10.0 10.0 10.0 10.0 10.0 10.0 10.0 Execution Result Enter an input file name: t3. txt Collegiate Pumpkin Toss Results 2022 Team # Avg. Distance 1000 9.50 meters 5050 10.00 meters 1001 10.00 meters First Place: Team 5050 (Avg. Dist: 10.00 m) Team 1001 (Avg. Dist: 10.00 m) Num. of Qualified Teams: 3 Num. of Disqualified Teams: 0 (4) Test case 4: 5 3000 30.0 30.0 25.5 30.0 30.0 25.7 30.0 30.0 4000 19.0 39.9 40.0 40.0 40.0 40.0 40.0 40.0 1000 10.0 10.0 7.0 10.0 10.0 6.0 10.0 10.0 2000 10.0 20.0 20.0 20.0 20.0 20.0 10.0 20.0 5000 50.0 50.0 50.0 50.0 50.0 50.0 41.0 40.9 Execution Result Enter an input file name: t4. txt Collegiate Pumpkin Toss Results 2022 Team # Avg. Distance 3000 30.00 meters 4000 40.00 meters 1000 10.00 meters 2000 20.00 meters 5000 50.00 meters First Place: Team 5000 (Avg. Dist: 50.00 m) Num. of Qualified Teams: 5 Num. f Disqualified Teams: 0(5) Test case 5: 5 3000 -1.5 30.0 45.5 30.0 30.0 75.7 30.0 30.0 4000 99.0 99.9 40.0 40.0 40.0 40.0 40.0 -40.0 1000 10.0 10.0 10.0 10.0 10.0 10.0 10.0 10.0 2000 50.0 20.0 20.0 20.0 -20.0 -20.0 -20.0 -20.0 5000 50.0 50.0 50.0 50.0 50.0 50.0 50.0 50.0 Execution Result Enter an input file name: $5 . txt Collegiate Pumpkin Toss Results 2022 Team # Avg. Distance 3000 Disqualified 4000 Disqualified 1000 10.00 meters 2000 Disqualified 5000 50.00 meters First Place: Team 5000 (Avg. Dist: 50.00 m) Num. of Qualified Teams: 2(6) Test case 6: 18 1001 -10.0 10.0 10.0 10.0 10.0 10.0 10.0 10.0 2001 20.0 -20.0 20.0 20.0 20.0 20.0 20.0 20.0 3001 30.0 30.0 -30.0 30.0 30.0 30.0 30.0 30.0 4001 40.0 40.0 40.0 -40.0 40.0 40.0 40.0 40.0 5001 50.0 50.0 50.0 50.0 -50.0 50.0 50.0 50.0 6001 60.0 60.0 60.0 60.0 60.0 -60.0 60.0 60.0 7001 70.0 70.0 70.0 70.0 70.0 70.0 -70.0 70.0 8001 80.0 80.0 80.0 80.0 80.0 80.0 80.0 -80.0 9001 90.0 90.0 90.0 90.0 90.0 90.0 90.0 -90.0 1000 10.0 10.0 10.0 10.0 10.0 10.0 10.0 10.0 2000 20.0 20.0 20.0 20.0 20.0 20.0 20.0 20.0 3000 30.0 30.0 30.0 30.0 30.0 30.0 30.0 30.0 4000 40.0 40.0 40.0 40.0 40.0 40.0 40.0 40.0 5000 50.0 50.0 50.0 50.0 50.0 50.0 50.0 50.0 6000 60.0 60.0 60.0 60.0 60.0 60.0 60.0 60.0 7000 70.0 70.0 70.0 70.0 70.0 70.0 70.0 70.0 8000 80.0 80.0 80.0 80.0 80.0 80.0 80.0 80.0 9000 90.0 90.0 90.0 90.0 90.0 90.0 90.0 90.0 = Execution Result samms Enter an input file name: t6. txt Collegiate Pumpkin Toss Results 2022 Team # Avg. Distance 1001 Disqualified 2001 Disqualified 3001 Disqualified 4001 Disqualified 5001 Disqualified 6001 Disqualified 7001 Disqualified 8001 Disqualified 9001 Disqualified 1000 10.00 meters 2000 20.00 meters 3000 30.00 meters 4000 40.00 meters 5000 50.00 meters 6000 60.00 meters 7000 70.00 meters 8000 80.00 meters 9000 90.00 meters First Place: Team 9000 (Avg. Dist: 90.00 m) Num. of Qualified Teams: 9 Num. Disqualified Teams

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

1. Does advertising belong in the schools? Why or why not?

Answered: 1 week ago