Question
Students who turn in either nonstandard C++ code or use material from chapters 10 or later must resubmit corrected standard C++ code versions to get
Students who turn in either nonstandard C++ code or use material from chapters 10 or later must resubmit corrected standard C++ code versions to get a grade no exceptions. Turning in nonstandard C++ code indicates that you are not following the book. Corrected assignments will be accepted after the five-day late period through email and be graded based on their earlier level of correctness.
For example, the following libraries will not be accepted:
#include //nonstandard
#include //beyond chapter nine
#include //beyond chapter nine
#include //a C library, not C++
Overview
In this assignment, you are going to write a program that will compute data for a Frisbee throwing contest. Each contestant received four opportunities to throw the Frisbee as far as they could. The contest data is stored in a text file named "frisbee_throw.txt" as follows. Distances are in feet.
note: (I copied the content of the text file here to make that easy for you, would you mind explaining who you bring txt file to the program as well please.. thank you very much)
Ashley White 68.21 133.50 147.56 54.90 Brad Smith 31.56 132.80 128.86 92.73 Lisa Johnson 131.61 101.49 120.36 92.82 Sheila Robinson 67.47 128.77 55.10 99.16 Rita Gupta 31.01 98.37 109.42 37.76 Ajay Kumar 34.58 57.75 115.61 78.46 Jose Ramey 95.00 41.53 108.75 79.99 Sheila Duffy 119.43 89.92 60.85 80.68 Tommy Pitts 124.87 28.92 136.21 96.07 Salma Quade 102.69 130.24 61.68 109.11 Jennifer Ackerman 100.14 63.31 99.58 75.76 Steve Sharma 68.64 111.13 88.68 96.50
Your program needs to read in the data, display the winner, and then display each contestants full name with the distance of their farthest throw (i.e., the largest of the four numbers following the persons name).
Program requirements:
Use a struct
Define your own contestant data struct consisting of three members:
- A char array of length 30 named fName. This will store the first name of a contestant.
- A char array of length 30 named lName. This will store the last name of a contestant.
- A float named longestDistance. This will store the distance of their farthest row.
Arrays
In main declare an array of 50 elements of type contestant data struct. You do not know how many players there will be, but imagine that you are expecting it to be much less than 50.
Input
Read in the data and fill values in the contest data array. Since you need only to store the longest distance for each contestant, the other three distance measurements are to be discarded. You will have to keep track of how many contestants there were. Assume that the data is perfectly formatted.
Output
Output the winner and individual best scores of each contestant using cout. Format the output in columns using setw() to make it clear and readable.
Equation Comments
Describe in pseudocode the algorithm which computes both individual and overall best scores.
Program template:
Copy the code below and fill in the blanks. If you like extend these comments listing all variables in the program.
/*CS 161 Assignment 8: Records (structs)
Filename: a08.cpp
Author: ___
Date: ___
Summary: ___
Functions (if any):
___
Variables:
___
*/
Design Considerations:
- Please name your file a08.cpp.
- No global variables. All variables must be inside main().
- Above main() write code comments describing the assignment.
Your application must be data-driven meaning your answer should be built from user input.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started