Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C++. Create a program that shows the output like the sample output. The Scores.txt and Team.h files were given. The task is to implement

Using C++. Create a program that shows the output like the sample output. The "Scores.txt" and "Team.h" files were given. The task is to implement and test a Team abstract data type (create "main.cpp" and "Team.cpp" to collect data from the file and show the output). Only allow adding non-member functions or private member functions to support the implementation of the public member functions. Cant modify the data member and public member functions.

Descriptions of the things have to do are listed next to each function in "Team.h".

note

Higher = team A is higher than

Lower = others team is higher than team A

Update status = update the number of higher or lower team compare to A

-----------Score.txt explanation and Sample output:--------------------------

  • The first line of the file contains the name and description of a Team and they are separated by a comma. Your main() function shall use these data to create an Account object. In addition, the main() function shall display information about the account. Here is a sample output:

Begin counting:

Team A from England.

Higher = 0

Lower = 0

The main () function shall then process one line of the Scores.txt file at a time until reaching the end of the file. Each line contains two words. The first word represents the description and the second word provides the name needed. The only exception is Update status, which indicates requesting the program to display the team information. The following is a sample output showing some results of processing the transactions in the Scores.txt file.

counting

Team A is higher than B

Team A from England.

Higher = 1. Higher than B

Lower = 0

Team A is higher than C

Team H is higher than team A.

Team A from England.

Higher = 2. Higher than C

Lower = 1. Lower than H

  • After all lines of the "Score.txt" file have been processed, the main function displays the information about the Team again. Here is a sample output.

After counting:

Team A from England.

Higher = 2. Higher than C

Lower = 1. Lower than H

------------------------Scores.txt------------------------------------

Team A, from England

higher B

Update status

higher C

higher D

higher E

higher F

lower H

Update status

lower I

lower B

lower F

Update status

lower J

lower K

--------------Team.h----------------------------

#ifndef Team _H

#define Team _H

#include

using namespace std;

// Only allow to add non-member functions or private member functions to support the implementation of the public member functions. Cant modify the data member and public member functions.

class Team {

private:

string name_;

string descript_;

string higher_;

string lower_;

public:

Team(const string& name, const string& descript); //create Team with name and descript

string getname() const; // to return the name of the invoking Team object. It shall not change any of the data members of the object.

string to_String() const; // not allow to use any output statement return a string object with this info:

// Username and description of the invoking account.

//Number of higher and the name of the oldest higher team.

//Number of lower and the name of the newest lower team.

bool addLower(const string& username); // returns false if the name provided is already lower the invoking Team. Returns true and adds the name to the lower_ data.

bool addHigher(const string& username); // returns false if the name provided is already higher the invoking Team. Returns true and adds the name to the higher_ data.

};

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 Systems Design Implementation And Management

Authors: Carlos Coronel, Steven Morris

14th Edition

978-0357673034

More Books

Students also viewed these Databases questions

Question

Example. Evaluate 5n+7 lim 7-00 3n-5

Answered: 1 week ago

Question

=+ What topics are contained in the contracts?

Answered: 1 week ago

Question

=+Are they specific or general in nature?

Answered: 1 week ago