Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++, Virtual Studios (type please) Text file: 1 100 M FREESTYLE 18 JAMES SMITH 01:10.01 TOM JONES 01:20.00 HOWARD COSELL 01:19.30 DON MEREDITH 01:21.28 RON

C++, Virtual Studios (type please)

image text in transcribedimage text in transcribed

image text in transcribed

Text file:

1

100 M FREESTYLE

18

JAMES SMITH 01:10.01

TOM JONES 01:20.00

HOWARD COSELL 01:19.30

DON MEREDITH 01:21.28

RON JONES 01:17.30

RICHARD LUCAS 01:09.30

RONNIE WERTH 01:11.38

JACK MOSES 01:19.94

DAN ROGERS 01:15.84

ROGER WILLIAMS 01:15.83

WILLIAM GEORGE 01:12.27

GEORGE JONES 01:13.45

MARK CHRISTIE 01:45.12

CHRIS LEOPARD 01:59.29

MAJOR APPLEWHITE DQ

RICK CHARLES 01:12.67

CHARLES SHERMAN 01:13.22

SHERMAN WILLIS 01:17.78

4(**). At the Texas high school championship swim meet, there are preliminary heats conducted for an event during the day to determine the 16 fastest swimmers in the meet who will swim in the championship finals and consolation finals at night. The fastest eight swimmers from the preliminary heats swim in the championship finals race and the next fastest eight swimmers swim in the consolation finals race. The remaining swimmers do not swim in the night events. In swimming, the lanes are numbered from 1 to 8 with lane 1 being on the far left and lane 8 being on the far right. The preferred lane numbers for a swimmer are in this order: 4,5, 3, 6, 2, 7, 1, 8. By seeding the swimmers in this order, the fastest swimmers have the advantage of swimming in the smooth water in the middle of the pool and the slower swimmers must fight the wake of the faster swimmers by swimming in the outside lanes. Write a C++ program that will find the 16 fastest swimmers from the list of preliminary swimmers and print their lane assignments for the consolation finals and championship finals races. Input will be from a text file where the first line of input will contain a single integer n that indicates the number of events to be swum. For each event: The first line will contain the name of the event. The second line will contain a single integer m that indicates the number of swimmers in that event. Each of the following m lines will contain: a swimmer's first and last name separated by a space but containing no other spaces, followed by a space, o the swimmer's time in the preliminary heat in the form:mm:ss.hh where mm is the number of minutes, ss is the number of seconds, and hh is the number of hundredths of a second, but o if the swimmer's time is DQ, the swimmer was disqualified from the event and cannot swim in the consolation finals or championship finals events. Assume that there are at least 10 swimmers that will qualify for the night events and no two swimmers have the exact same time. For each event output: Seed the swimmers into their preferred lanes based on the lane order above. Then print the event and a space followed by CONSOLATION FINALS. On each of the next 8 lines (or less if there are not enough swimmers): o Print the lane number, in order 1-8, followed by a period and a space, Print the last name, a comma and a space followed by the first name of the swimmer assigned to that lane, and then another space, and finally, Print the seed time of the swimmer as shown in the example on the next page. Do not assign a lane to or print the name of any disqualified swimmers. Print a blank line. Then print the event and a space followed by CHAMPIONSHIP FINALS. On each of the next 8 lines (or less if there are not enough swimmers): o Print the lane number, in order 1-8, followed by a period and a space, o Print the last name, a comma and a space followed by the first name of the swimmer assigned to that lane, and then another space, and finally, o Print the seed time of the swimmer as shown in the example on the next page. Print a blank line. A blank line is optional after the last data set. 0 0 o Let the user input the file name from the keyboard. Use any appropriate sort as needed. Refer to the sample output below. Sample Run: Enter the file name: swim.txt 100 M FREESTYLE CONSOLATION FINALS 1 MEREDITH, DON 01:21.28 2 MOSES, JACK 01:19.94 3 WILLIS, SHERMAN 01:17.78 4 ROGERS, DAN 01:15.84 5 JONES, RON 01:17.30 6 COSELL, HOWARD 01:19.30 7 JONES, TOM 01:20.00 8 CHRISTIE, MARK 01:45.12 100 M FREESTYLE CHAMPIONSHIP FINALS 1 JONES, GEORGE 01:13.45 2 CHARLES, RICK 01:12.67 3 WERTH, RONNIE 01:11.38 4 LUCAS, RICHARD 01:09.30 5 SMITH, JAMES 01:10.01 6 GEORGE, WILLIAM 01:12.27 7 SHERMAN, CHARLES 01:13.22 8 WILLIAMS, ROGER 01:15.83

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

More Books

Students also viewed these Databases questions