Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ questions!!! I attached sports.dat at the bottom. sports.dat 0 Horses Fish 1 4 0 Birds Cats 0 1 0 Horses Rats 9 6 0

C++ questions!!! I attached sports.dat at the bottom.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

sports.dat

0 Horses Fish 1 4 0 Birds Cats 0 1 0 Horses Rats 9 6 0 Fish Horses 2 0 0 Rats Bunnies 1 5 0 Cats Dogs 0 14 0 Birds Fish 3 1 0 Cats Birds 6 4 0 Fish Birds 17 3 0 Dogs Bunnies 0 3 0 Bunnies Dogs 0 2 0 Bunnies Fish 1 9 0 Birds Rats 0 6 0 Dogs Fish 3 2 0 Fish Rats 2 1 0 Fish Dogs 12 3 0 Horses Bunnies 1 2 0 Rats Cats 0 1 0 Horses Birds 3 2 0 Birds Horses 2 5 0 Rats Fish 0 2 0 Cats Bunnies 1 0 0 Dogs Horses 5 4 0 Cats Fish 1 2 0 Dogs Cats 5 1 0 Bunnies Rats 3 4 0 Bunnies Horses 1 0 0 Rats Birds 2 0 0 Dogs Birds 2 0 0 Birds Bunnies 0 8 0 Cats Horses 3 0 0 Fish Cats 3 1 0 Horses Dogs 5 0 1 Fish Rats 0 5 1 Horses Cats 3 2 1 Bunnies Dogs 4 2 1 Horses Dogs 0 1 1 Cats Rats 5 2 1 Horses Rats 5 7 1 Birds Horses 1 3 1 Bunnies Horses 0 1 1 Fish Cats 2 0 1 Dogs Bunnies 2 1 1 Dogs Cats 4 1 1 Dogs Rats 0 2 1 Birds Cats 2 3 1 Cats Dogs 3 0 1 Birds Bunnies 1 2 1 Horses Bunnies 7 1 1 Dogs Fish 1 0 1 Birds Dogs 0 1 1 Birds Fish 1 2 1 Fish Bunnies 2 1 1 Rats Birds 2 0 1 Bunnies Birds 1 2 1 Rats Cats 6 1 1 Fish Horses 8 0 1 Cats Horses 3 0 1 Fish Dogs 3 2 1 Birds Rats 0 1 1 Cats Bunnies 6 4 1 Bunnies Cats 4 2 1 Dogs Horses 0 7 1 Fish Birds 3 0 1 Dogs Birds 1 2 1 Bunnies Rats 4 11 2 Horses Bunnies 2 5 2 Bunnies Birds 2 1 2 Rats Cats 1 0 2 Dogs Horses 4 0 2 Fish Birds 1 2 2 Fish Horses 1 0 2 Birds Dogs 0 1 2 Birds Cats 0 1 2 Dogs Cats 5 2 2 Bunnies Fish 5 2 2 Bunnies Rats 0 1 2 Fish Dogs 9 0 2 Rats Horses 0 2 2 Birds Horses 0 1 2 Horses Fish 0 7 2 Cats Horses 1 2 2 Dogs Bunnies 5 8 2 Horses Birds 3 2 2 Bunnies Dogs 5 1 2 Fish Cats 6 2 2 Bunnies Horses 0 4 2 Dogs Fish 2 7 2 Rats Birds 1 2 2 Rats Fish 3 8 2 Fish Bunnies 8 2 2 Rats Bunnies 1 0 2 Dogs Birds 10 0 2 Cats Birds 1 2 2 Horses Dogs 0 3 2 Fish Rats 8 0 2 Cats Rats 3 2 2 Cats Fish 1 0 2 Rats Dogs 1 0 3 Cats Rats 3 2 3 Dogs Rats 0 7 3 Birds Fish 0 5 3 Bunnies Dogs 10 0 3 Birds Dogs 2 3 3 Dogs Horses 0 1 3 Dogs Birds 3 0 3 Fish Bunnies 2 3 3 Rats Bunnies 6 2 3 Birds Horses 0 1 3 Bunnies Cats 10 2 3 Bunnies Rats 1 2 3 Horses Birds 0 2 3 Rats Horses 1 3 3 Fish Rats 0 3 3 Cats Dogs 4 5 3 Rats Birds 2 3 3 Birds Rats 3 1 3 Horses Fish 0 2 3 Dogs Bunnies 0 5 3 Bunnies Birds 3 0 3 Birds Cats 4 3 3 Cats Bunnies 14 1 3 Dogs Fish 0 1 3 Cats Horses 0 4 3 Birds Bunnies 1 5 3 Cats Birds 4 0 3 Dogs Cats 4 0 3 Rats Cats 7 15 3 Horses Bunnies 5 2 3 Fish Dogs 1 0 3 Rats Dogs 1 0 3 Fish Cats 14 3 4 Cats Dogs 1 0 4 Dogs Bunnies 9 6 4 Bunnies Rats 4 0 4 Rats Bunnies 0 1 4 Horses Birds 3 0 4 Rats Fish 2 1 4 Horses Bunnies 6 2 4 Dogs Rats 3 0 4 Cats Bunnies 1 3 4 Birds Bunnies 3 2 4 Rats Cats 0 2 4 Fish Bunnies 3 4 4 Horses Cats 2 1 4 Cats Horses 0 6 4 Fish Birds 2 3 4 Horses Fish 4 0 4 Birds Rats 0 9 4 Dogs Fish 3 1 4 Bunnies Fish 2 1 4 Dogs Birds 5 2 4 Dogs Horses 9 10 4 Fish Dogs 9 2 4 Birds Fish 0 1 4 Bunnies Horses 1 2 4 Rats Horses 2 1 4 Cats Birds 3 1 4 Horses Rats 0 5 4 Birds Horses 1 4 4 Bunnies Birds 4 0 4 Fish Horses 4 2 4 Fish Rats 2 0 4 Birds Cats 0 2 4 Bunnies Dogs 2 5 5 Rats Horses 3 1 5 Horses Bunnies 1 0 5 Rats Dogs 1 0 5 Bunnies Rats 2 12 5 Cats Bunnies 1 2 5 Dogs Cats 2 5 5 Fish Bunnies 7 1 5 Dogs Bunnies 0 4 5 Dogs Fish 5 3 5 Birds Bunnies 0 1 5 Horses Fish 1 0 5 Rats Bunnies 3 1 5 Birds Dogs 0 1 5 Horses Birds 8 1 5 Bunnies Dogs 0 3 5 Fish Birds 1 2 5 Rats Cats 1 0 5 Bunnies Cats 2 9 5 Rats Fish 1 0 5 Bunnies Fish 1 3 5 Birds Rats 0 4 5 Dogs Birds 5 1 5 Fish Cats 6 0 5 Horses Dogs 2 3 5 Birds Cats 0 1 5 Horses Cats 3 1 5 Birds Horses 1 0 5 Horses Rats 4 1 5 Cats Rats 6 5 5 Cats Birds 0 3 5 Fish Rats 14 11 5 Dogs Rats 1 0 5 Dogs Horses 1 4 6 Fish Dogs 2 1 6 Dogs Horses 4 2 6 Rats Fish 3 2 6 Bunnies Cats 2 11 6 Bunnies Fish 2 3 6 Horses Fish 1 5 6 Rats Birds 3 0 6 Fish Horses 7 2 6 Fish Rats 10 2 6 Cats Horses 5 0 6 Bunnies Rats 1 0 6 Bunnies Horses 1 6 6 Bunnies Dogs 2 3 6 Cats Dogs 3 1 6 Cats Rats 4 3 6 Birds Bunnies 2 1 6 Rats Dogs 0 2 6 Dogs Cats 2 1 6 Fish Bunnies 0 1 6 Birds Dogs 0 4 6 Bunnies Birds 2 4 6 Horses Birds 8 0 6 Cats Birds 3 2 6 Birds Fish 0 4 6 Dogs Birds 8 0 6 Dogs Rats 0 3 6 Birds Horses 1 5 6 Cats Bunnies 0 3 6 Fish Cats 8 1 6 Birds Cats 1 5 6 Horses Bunnies 6 2 6 Horses Dogs 2 8 6 Rats Horses 2 0 7 Horses Cats 4 2 7 Rats Fish 0 1 7 Fish Bunnies 4 2 7 Cats Fish 1 3 7 Birds Rats 0 5 7 Bunnies Birds 7 2 7 Dogs Fish 24 2 7 Horses Rats 4 16 7 Cats Dogs 3 8 7 Rats Bunnies 0 2 7 Rats Dogs 0 6 7 Fish Cats 3 1 7 Horses Bunnies 0 8 7 Dogs Horses 1 0 7 Cats Rats 1 5 7 Rats Cats 1 3 7 Bunnies Fish 1 4 7 Horses Dogs 0 3 7 Birds Cats 5 0 7 Dogs Bunnies 0 3 7 Dogs Cats 3 2 7 Rats Birds 4 0 7 Rats Horses 2 0 7 Cats Bunnies 1 5 7 Horses Fish 1 7 7 Birds Dogs 0 3 7 Fish Birds 0 1 7 Dogs Birds 0 2 7 Horses Birds 3 1 7 Birds Bunnies 2 0 7 Cats Horses 1 0 7 Bunnies Dogs 3 1 7 Birds Fish 0 1 8 Horses Fish 0 2 8 Birds Horses 0 2 8 Cats Horses 2 8 8 Bunnies Rats 0 6 8 Bunnies Birds 2 5 8 Horses Birds 2 1 8 Horses Bunnies 3 2 8 Horses Dogs 1 0 8 Birds Cats 1 3 8 Rats Bunnies 1 2 8 Cats Bunnies 0 3 8 Dogs Cats 4 0 8 Horses Rats 0 1 8 Fish Cats 0 3 8 Dogs Bunnies 5 4 8 Birds Bunnies 3 1 8 Birds Rats 0 6 8 Cats Birds 0 3 8 Cats Rats 1 0 8 Bunnies Cats 11 2 8 Dogs Rats 2 0 8 Dogs Birds 0 1 8 Rats Fish 4 0 8 Fish Bunnies 0 1 8 Birds Dogs 5 6 8 Horses Cats 1 0 8 Dogs Fish 0 3 8 Dogs Horses 2 7 8 Fish Rats 3 8 8 Fish Horses 1 0 8 Fish Birds 5 3 8 Rats Horses 3 1 8 Birds Fish 0 4 9 Rats Fish 3 0 9 Birds Dogs 1 2 9 Fish Horses 0 3 9 Cats Birds 2 1 9 Horses Fish 6 2 9 Dogs Fish 2 7 9 Fish Dogs 4 2 9 Fish Bunnies 1 2 9 Horses Bunnies 6 5 9 Bunnies Cats 1 4 9 Cats Fish 0 3 9 Birds Bunnies 0 1 9 Bunnies Horses 3 0 9 Rats Horses 3 2 9 Birds Cats 0 1 9 Bunnies Birds 2 0 9 Fish Birds 2 0 9 Dogs Cats 6 4 9 Rats Cats 0 2 9 Dogs Rats 6 3 9 Birds Fish 0 2 9 Rats Bunnies 3 8 9 Horses Cats 7 3 9 Cats Horses 4 3 9 Fish Cats 6 0 9 Fish Rats 4 3 9 Birds Rats 1 0 9 Horses Dogs 2 0 9 Dogs Horses 3 4 9 Dogs Birds 12 3 9 Cats Rats 0 3 9 Horses Rats 0 3 9 Dogs Bunnies 4 0

simple program can often read and summarize large amounts of information much faster than any human. Once there's enough data to work with it can sometimes be impossible to understand except through computer summarization. One popular example of this is using programs to better understand the large volume of data generated by various sporting leagues For this problem you will need the sports.dat file from Canvas. This file contains in- formation from the BPL (Beloved Pet League). In the beloved pet league seven teams (Cats, Dogs, Bunnies, Rats, Birds, Fish, and Horses) compete to be the most beloved pets. sports.dat contains data about 330 matches from 10 seasons of the BPL. Each line of sports.dat is formatted as follows An excerpt of the file is belovw 0 Horses Fish 1 4 0 Birds Cats 0 1 0 Horses Rats 9 6 0 Fish Horses 2 0 0 Rats Bunnies 1 5 This example shows a few properties of the file: Teams can play each-other more than once per season (Fish and Horses) different order between their two matches) higher score . A team may be either team1 or team 2 (Note how Fish and Horses appear in a . The BPL does not allow ties, so matches continue until one team or the other has a Your task in this problem is to write a program to help us summarize the BPL data and settle questions such as "which pet is better, Cats or Dogs?" To do this your program will first need to ask the user which two teams they wish to compare. The will need to read the BPL file match-by-match. For each match you will need to determine whether the read the BPL file match-by-match. For each match you will need to determine whether the inalch was betww.ti ulac-uatna"L uratims, anhtnr k1erinimr who won. ALLIK. (TH it will nexxl to print how many matches occurred between the two teams, how many times each team won, and which team won the most. Examples are below. (Formatting note, only one space is used or expected in all places in this example) Example T Please input the two teams you are interested in: Cats Dogs The Cats and the Dogs played 15 times. The Cats won 4 times. The Dogs won 11 times The Dogs are the better team! Example 2: Please input the two teams you are interested in: Cats Rats The Cats and the Rats played 16 times. The Cats won 11 times The Rats won 5 times The Cats are the better team! Notes: The examples above are based one the same data file you were given . You can assume the data file will always be named sports.dat. . You cannot assume that your code will be graded on the same sports.dat file as the one provided on Canvas. You should not assume that sports.dat has exactly 330 matches in it. . You do not have to validate team names, if the user enters a team that is not in the BPL, t should show no matches. (see example 4) Team names are case sensitive. While the Cats" are a team in the BPL, the "cats" are not .You may find it useful to write functions to simplify parts of this program. For example a printResults function will certainly make the main method easier to read and more elegant

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

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions

Question

code in Java please

Answered: 1 week ago

Question

politeness and modesty, as well as indirectness;

Answered: 1 week ago