Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Programming Assignment 1 In this project, you will write a program that helps a player select players in Fantasy Premier League game. You have 100

Programming Assignment 1

In this project, you will write a program that helps a player select players in Fantasy Premier League game. You have 100 to get 15 players, distributed as follows:

10 to get 2 goal keepers

25 to get 5 defenders

35 to get 5 midfielders

30 to get 3 forwards

You will develop the following classes:

Player class: It is an abstract base class and has as private data fields

string name;

string team;

string position;

double price;

int ptsPrevSeason;

As regular public methods, the getters and setters of each private data field

An abstract function selectPlayer defined as follows

virtual vector selectPlayer(vector players)=0;

Goalkeeper class:

This is a derived class of class Player

It overrides selectPlayer method to select the designed players for goalkeeper position

It defines the budget for goalkeepers as static const

Defender class:

This is a derived class of class Player

It overrides selectPlayer method to select the designed players for defender position

It defines the budget for defender as static const

Midfielder class:

This is a derived class of class Player

This is a derived class of class Player

It overrides selectPlayer method to select the designed players for midfielder position

It defines the budget for midfielder as static const

Forward class:

This is a derived class of class Player

It overrides selectPlayer method to select the designed players for forward position

It defines the budget for forward as static const

You are given in Players.txt the list of player names, teams, positions, price and points in previous season. You have to parse this file to populate the vectors of players of type goalkeeper, defender, midfielder and forward.

When overriding selectPlayer method at each derived class, you must count the available budget for that position and substract the amount of money you spent for previous players taking into consideration that you can select exactly only 2 goalkeepers, 5 defenders, 5 midfielders and 3 forwards.

You are given some handouts of sample code to read from/write to a file and to insert to/ delete from vectors.

Write the final squad choice into file Squad.txt as follows:

*****************************

The selected Goalies are:

*****************************

Hugo Lloris (Spurs)

Heurelho Gomes (Watford)

*****************************

The selected Defenders are:

*****************************

Kyle Walker (Man City)

Daley Blind (Man Utd)

Hector Bellerin (Arsenal)

Alberto Moreno (Liverpool)

Seamus Coleman (Everton)

*****************************

The selected Midfielders are:

*****************************

Dimitri Payet (West Ham)

Oscar (Chlesea)

Sadio Mane (Liverpool)

Anthony Martial (Man Utd)

Christian Eriksen (Spurs)

*****************************

The selected Forwards are:

*****************************

Sergio Aguero (Man City)

Jermain Defoe (Sunderland)

Harry Kane (Spurs)

Deliverable: Zipped File of your Project Folder that contains all your C++ files. You may work in pairs on this project.

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

101 Database Exercises Text Workbook

Authors: McGraw-Hill

2nd Edition

0028007484, 978-0028007489

More Books

Students also viewed these Databases questions

Question

2. What, according to Sergey, was strange at this meeting?

Answered: 1 week ago