Answered step by step
Verified Expert Solution
Link Copied!

Question

...
1 Approved Answer

Stock Car Drivers The stock car racing season is coming to an end, with only four races left. Eight drivers are eligible to pursue the

Stock Car Drivers

The stock car racing season is coming to an end, with only four races left. Eight drivers are eligible to pursue the championship, but those who drop out of, or are disqualified from, any of the four races will not be considered for the championship.

Drivers who finish all four races are rewarded with points depending on the place they finish in each race: 100 points for first place, 90 points for second place, 80 points for third, 70 points for fourth, 60 points for fifth, and no points below fifth place.

The championship will be won by the driver whose average points for the four races is highest and is at least 85, the standard set by Floe Dynamo in 1837. However, it's possible none of the remaining contenders will average 85 points or above, and there will be no champion this year.

Write a program which processes the drivers and determines the champion, if any, of this years' stock car season.

In main:

-declare an 8 X 4 array of "int"s named "points" to hold the four points earned by each contender for the four races (the rows represent up to 8 contending drivers and the columns represent the 4 races); also declare a vector to hold the drivers' names.

-have the user enter a text file name (the text file will be used to hold the average points for each of the remaining drivers).

-call a function which uses nested loops for array and vector processing. Have the user repeatedly enter a driver's name and place it in the vector, and enter that driver's four points, using the name as a prompt, and place the four points into the "points" array. Validate that the points entered are either 60, 70, 80, 90, or 100. The number of drivers who will finish all 4 races is unknown, but not more than 8 (Hint: count the number of drivers and use it for subsequent processing). You may not ask the user how many drivers are participating in all four races.

-call a second function which uses the "points" array to calculate each driver's average and place each average into the text file.

In main, use the vector and the text file of averages to display the name and average points for each of the contenders, determine the winner (if any), and display the winner's name and average or display a message that there was no winner. Display all averages to 1 decimal point.

Note: arrays and vectors must be processed with loops, and any vector statements or member functions must come from our textbook, in Chapter 7.

Submit two screen prints using the following data:

1) Moe Joe: 70, 90, 90, 100

Joe DeSmo: 90, 90, 100, 90

Zoe AnGoe: 90, 70, 80, 60

2) Moe Joe: 70, 70, 80, 100

Zoe AnGoe: 80, 90, 80, 80

Joe DeSmo: 60, 90, 80, 70

Flo DeSmo: 100, 80, 80, 70

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Intermediate Accounting

Authors: James D. Stice, Earl K. Stice, Fred Skousen

17th Edition

978-0324592375

Students also viewed these Programming questions