Programming Assignment
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<Player*> selectPlayer(vector<Player*> 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 have to 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.
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)
use this >>
Thibaut Courtois#Chelsea#Goalkeeper#6.0#69 Hugo Lloris#Spurs#Goalkeeper#5.0#140 Heurelho Gomes#Watford#Goalkeeper#4.5#15 Joe Hart#Man City#Goalkeeper#5.5#141 Jack Butland#Stoke#Goalkeeper#4.5#132 Adrian#West Ham#Goalkeeper#4.5#125 Kasper Schmeichel#Leicester#Goalkeeper#5.0#147 David De Gea#Man Utd#Goalkeeper#5.5#142 Petr Cech#Arsenal#Goalkeeper#5.5#159 Kyle Walker#Man City#Defender#5.0#121 Daley Blind#Man Utd#Defender#5.0#95 Hector Bellerin#Arsenal#Defender#5.0#172 Leighton Baines#Everton#Defender#5.5#67 Christian Fuchs#Leicester#Defender#5.5#150 Laurent Koscielny#Arsenal#Defender#6.0#153 Aaron Cresswell#West Ham#Defender#5.3#133 Chris Smalling#Man Utd#Defender#6.0#135 Virgil van Dijk#Southampton#Defender#5.4#130 Luke Shaw#Man Utd#Defender#5.5#27 Branislav Ivanovic#Chelsea#Defender#6.0#111 Alberto Moreno#Liverpool#Defender#4.5#104 Seamus Coleman#Everton#Defender#5.5#94 Nacho Monreal#Arsenal#Defender#6.0#152 Toby Alderweireld#Spurs#Defender#6.5#166 Nicolas Otamendi#Man City#Defender#5.5#104 Aleksandar Kolarov#Man City#Defender#5.0#118 Cesar Azpilicueta#Chelsea#Defender#6.0#124 Wes Morgan#Leicester#Defender#5.0#139 Nathaniel Clyne#Liverpool#Defender#5.5#93 Ryan Bertrand#Southampton#Defender#5.4#106 Ramiro Funes Mori#Everton#Defender#4.5#92 Jose Fonte#Southampton#Defender#5.4#127 John Stones#Man City#Defender#5.0#82 Bacary Sagna#Man City#Defender#5.0#116 Dimitri Payet#West Ham#Midfielder#8.5#191 Oscar#Chlesea#Midfielder#7.0#54 Sadio Mane#Liverpool#Midfielder#7.0#147 Anthony Martial#Man Utd#Midfielder#6.5#157 Christian Eriksen#Spurs#Midfielder#6.0#164 Riyad Mahrez#Leicester#Midfielder#9.5#240 Alexis Sanchez#Arsenal#Midfielder#11.5#196 Eden Hazard#Chlesea#Midfielder#10.0#181 Roberto Firmino#Liverpool#Midfielder#8.0#169 Kevin De Bruyne#Man City#Midfielder#10.5#197 Mesut Ozil#Arsenal#Midfielder#9.5#182 Dele Alli#Spurs#Midfielder#7.0#152 Gylfi Sigurdsson#Swansea#Midfielder#6.5#151 David Silva#Man City#Midfielder#8.0#149 Ross Barkley#Everton#Midfielder#6.5#145 Philippe Coutinho#Liverpool#Midfielder#8.0#145 Dusan Tadic#Southampton#Midfielder#6.5#131 Aaron Ramsey#Arsenal#Midfielder#8.0#129 Marko Arnautovic#Stoke#Midfielder#6.5#123 Cesc Fabregas#Chelsea#Midfielder#7.5#118 Yannick Bolasie#Everton#Midfielder#6.1#100 Willian#Chelsea#Midfielder#7.5#97 Michail Antonio#West Ham#Midfielder#6.5#96 Raheem Sterling#Man City#Midfielder#8.5#57 Pedro#Chelsea#Midfielder#7.5#24 Sergio Aguero#Man City#Forward#12.5#184 Jermain Defoe#Sunderland#Forward#7.2#138 Harry Kane#Spurs#Forward#9.5#211 Jamie Vardy#Leicester#Forward#9.0#211 Daniel Sturridge#Liverpool#Forward#9.0#70 Romelu Lukaku#Everton#Forward#8.5#185 Diego Costa#Chelsea#Forward#9.0#129 Olivier Giroud#Arsenal#Forward#8.5#156 Troy Deeney#Watford#Forward#6.5#166 Shane Long#Southampton#Forward#6.1#109 Kelechi Iheanacho#Man City#Forward#6.5#80 Wayne Rooney#Man Utd#Forward#9.0#118 Odion Ighalo#Watford#Forward#7.5#175 Saido Berahino#West Brom#Forward#5.0#68 Andy Carroll#West ham#Forward#6.5#90 Salomon Rondon#West Brom#Forward#6.5#118


0 comments