Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Problem C: Tournament of Pets (20 points) One of the most popular use for computer programming is analyzing large data files. A simple program

C++ image text in transcribed
image text in transcribed
image text in transcribed
Problem C: Tournament of Pets (20 points) One of the most popular use for computer programming is analyzing large data files. A 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: kteam 2 score> An excerpt of the file is below 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) . A team may be either team 1 or team 2 (Note how Fish and Horses appear in a different order between their two matches) . The BPL does not allow ties, so matches continue until one team or the other has a higher score. 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. Then it will need to read the BPL file match-by-match. For each match you will need to determine whether the match was between the target teams, and determine who won. At the end it will need 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 1 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! Example 3: Please input the two teams you are interested in: Dogs Rats The Dogs and the Rats played 12 times The Dogs won 6 times. The Rats won 6 times. The teams are equally matched! Example 4: Please input the two teams you are interested in: Rocks Horses The Rocks and the Horses played 0 times The Rocks won 0 times. The Horses won 0 times. The teams are equally matched! 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 . Team names are case sensitive. While the "Cats" are a team in the BPL, the "cats" . You may find it useful to write functions to simplify parts of this program. For BPL, it should show no matches. (see example 1) are not. 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

Database And Expert Systems Applications Dexa 2021 Workshops Biokdd Iwcfs Mlkgraphs Al Cares Protime Alsys 2021 Virtual Event September 27 30 2021 Proceedings

Authors: Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil ,Bernhard Moser ,Atif Mashkoor ,Johannes Sametinger ,Anna Fensel ,Jorge Martinez-Gil ,Lukas Fischer

1st Edition

3030871002, 978-3030871000

More Books

Students also viewed these Databases questions