Code for 2k game with 300 lines1. NOTE: This program must have at least 300 lines.2. Write a Player class.3. Randomly make an array of 10 players enter the locker room one by one using the cin...

1 answer below »
I need help with my C++. I have attached a docx with the instructions I'm supposed to write for the code.


Code for 2k game with 300 lines 1. NOTE: This program must have at least 300 lines. 2. Write a Player class. 3. Randomly make an array of 10 players enter the locker room one by one using the cin to type in their psn name. 4. After typing in the player’s psn, display a message whereas each player is randomly assigned one at a time to the white or black teams. Also randomly assign each player a position. The output, for example: SG, So and so has been assigned to the black team. 5. Each team should have 5 players. 6. Start the game, randomly display quarter 1 and quarter 2 players stats with the team they are assigned to. Also display the generated positions next to the players name the same way in step 5 for all quarters. For example, Quarter 1: White: SG So and so: Points, assists, rebounds… Black: PF So and so: Points, assists, rebounds… Quarter 2: White: SG So and so: Points, assists, rebounds… Black: PF So and so: Points, assists, rebounds… 7. Halftime display the total team stats of all players from quarter 1 and quarter 2 For example, White: points, assists, rebounds… Black: points, assists, rebounds.. 8. With the total players stats from quarter 1 and 2, combine these stats with a random quarter 3 and quarter 4 players’ stats and display the stats with their generated position. For example: Quarter 3: White: SG So and so: Points, assists, rebounds… Black: PF So and so: Points, assists, rebounds… Quarter 4: White: SG So and so: Points, assists, rebounds… Black: PF So and so: Points, assists, rebounds… 9. End the game with displaying the final score of all the players points by adding all their points together they have scored in each quarter. Then, add the total of all the players stats from all quarters for the winning team. For example, Final score: White: 130 Black: 129 White team has won! The game’s final stats: White team stats: Points, assists, rebounds… Black team stats: Points, assists, rebounds… The Final Project Grading Check List In your final project, your code must be able to run. Otherwise, you can only get 60% at most from the total points.  You also need to check if you have the following concepts/variables/functions that are implemented.  (1) Classes and inheritance, (<=20 pt)="" (2)="" overloading,=""><=10 pt)="" (3)="" overriding,=""><=10 pt)="" (4)="" public,="" private,="" protected,=""><=10 pt)="" (5)="" set(),="" get(),="" methods=""><= 5="" pt)="" (6) abstract="" class=""><=5pt) (7)="" static="" or="" vector="" should="" be included="" (add=""><=5 pt="" if="" you="" have="" both)=""><=5 pt)="" (8)="" sorting="" or="" searching="" methods="" should="" be="" included="" for="" your="" job="" finding. (=""><=5 pt)="" ,="" add="" 5="" pt="" extra="" if="" you="" did="" both.="" the="" above="" list="" worth="" 70="" pts="" total.="" if="" you="" are="" using="" file="" accessing="" and="" other="" advanced="" c++="" coding="" techniques.="" some="" points="" will="" be="" added="" to="" your="" projects. =""  ="" you="" will="" get="" basic="" points="" for="" each="" item="" listed="" above="" if="" you="" have="" done="" it="" in="" your="" project="" (80%)="" .="" another="" 20%="" will="" be="" given="" to="" the="" student="" who="" will="" do="" excellent="" and="" meaningful="" work="" about="" the="" item="" listed="" above.="" for="" instance,="" you="" implement="" inheritance,="" but="" there="" is="" not="" necessary="" or="" does="" not="" have="" real="" meaning,="" you="" only="" get="" a="" 10*80%="8" points. ="" overall="" project="" 20pt:=""><=10pt for="" operation="" smoothness,="" comments="" and="" readability=""><=10pt). a="" short="" report="" (or="" menu)="" to="" tell="" us="" how="" you="" implement="" the="" project,="" or="" what="" is="" new,="" and/or="" what="" you="" learn.=""><=10 pt.) ="" #include=""> #include #include #include using namespace std; // Player class definition class Player { string psn; string team; string position; int points; int assists; int rebounds; int steals; int turnovers; int fouls; public: Player() { psn = ""; team = ""; position = ""; points = 0; assists = 0; rebounds = 0; steals = 0; turnovers = 0; fouls = 0; } // Overloading constructor Player(string psnName) { psn = psnName; team = ""; position = ""; points = 0; assists = 0; rebounds = 0; steals = 0; turnovers = 0; fouls = 0; } // Set player psn void setPsn(string psnName) { psn = psnName; } // Get player psn string getPsn() { return psn; } // Set player team void setTeam(string teamName) { team = teamName; } // Get player team string getTeam() { return team; } // Set player position void setPosition(string pos) { position = pos; } // Get player position string getPosition() { return position; } // Set player points void setPoints(int pts) { points = pts; } // Get player points int getPoints() { return points; } // Set player assists void setAssists(int ast) { assists = ast; } // Get player assists int getAssists() { return assists; } // Set player rebounds void setRebounds(int reb) { rebounds = reb; } // Get player rebounds int getRebounds() { return rebounds; } // Set player steals void setSteals(int steal) { steals = steal; } // Get player steals int getSteals() { return steals; } // Set player turnovers void setTurnovers(int TO) { turnovers = TO; } // Get player turnovers int getTurnovers() { return turnovers; } // Set player fouls void setFouls(int foul) { fouls = foul; } // Get player fouls int getFouls() { return fouls; } // Overloading operator for sorting players based on points friend bool operator < (const="" player&="" p1,="" const="" player&="" p2)="" {="" return="" p1.points=""> p2.points; } // function to print player stats void printStats() { cout < psn="">< ":="" ";="" cout="">< "points:="" "="">< points="">< "="" ";="" cout="">< "assists:="" "="">< assists="">< "="" ";="" cout="">< "rebounds:="" "="">< rebounds="">< "="" ";="" cout="">< "steals:="" "="">< steals="">< "="" ";="" cout="">< "turnovers:="" "="">< turnovers="">< "="" ";="" cout="">< "fouls:="" "="">< fouls="">< endl;="" }="" };="" function="" to="" randomly="" assign="" player="" to="" team="" void="" assignteam(player*="" players,="" int="" size)="" {="" seed="" random="" number="" generator="" srand((unsigned)time(null));="" randomly="" assign="" players="" to="" team="" string="" teams[2]="{"White"," "black"};="" int="" teamindex;="" for="" (int="" i="0;" i="">< size;="" i++)="" {="" teamindex="rand()" %="" 2;="" players[i].setteam(teams[teamindex]);="" }="" }="" function="" to="" randomly="" assign="" position="" to="" player="" void="" assignposition(player*="" players,="" int="" size)="" {="" seed="" random="" number="" generator="" srand((unsigned)time(null));="" randomly="" assign="" players="" to="" position="" string="" positions[5]="{"PG"," "sg",="" "sf",="" "pf",="" "c"};="" int="" posindex;="" for="" (int="" i="0;" i="">< size;="" i++)="" {="" posindex="rand()" %="" 5;="" players[i].setposition(positions[posindex]);="" }="" }="" function="" to="" randomly="" generate="" stats="" for="" a="" quarter="" void="" generatestats(player*="" players,="" int="" size,="" string="" quarter)="" {="" seed="" random="" number="" generator="" srand((unsigned)time(null));="" output="" message="" cout="">< "\n"="">< quarter="">< "="" stats:"="">< endl;="" generate="" stats="" for="" each="" player="" int="" pts,="" ast,="" reb,="" steal,="" to,="" foul;="" for="" (int="" i="0;" i="">< size;="" i++)="" {="" pts="rand()" %="" 30;="" ast="rand()" %="" 10;="" reb="rand()" %="" 10;="" steal="rand()" %="" 10;="" to="rand()" %="" 10;="" foul="rand()" %="" 3;="" players[i].setpoints(pts);="" players[i].setassists(ast);="" players[i].setrebounds(reb);="" players[i].setsteals(steal);="" players[i].setturnovers(to);="" players[i].setfouls(foul);="" output="" stats="" players[i].printstats();="" }="" }="" function="" to="" calculate="" total="" stats="" for="" a="" player="" void="" calculatetotalstats(player*="" players,="" int="" size,="" string="" quarter)="" {="" output="" message="" cout="">< "\n"="">< quarter="">< "="" total="" stats:"="">< endl;="" calculate="" total="" stats="" for="" each="" player="" int="" totalpts="0," totalast="0," totalreb="0," totalsteals="0," totalturnovers="0," totalfouls="0;" for="" (int="" i="0;" i="">< size;="" i++)="" {="" totalpts="" +="players[i].getPoints();" totalast="" +="players[i].getAssists();" totalreb="" +="players[i].getRebounds();" totalsteals="" +="players[i].getSteals();" totalturnovers="" +="players[i].getTurnovers();" totalfouls="" +="players[i].getFouls();" }="" output="" total="" stats="" cout="">< "points:="" "="">< totalpts="">< "="" ";="" cout="">< "assists:="" "="">< totalast="">< "="" ";="" cout="">< "rebounds:="" "="">< totalreb="">< "="" ";="" cout="">< "steals:="" "="">< totalsteals="">< "="" ";="" cout="">< "turnovers:="" "="">< totalturnovers="">< "="" ";="" cout="">< "fouls:="" "="">< totalfouls="">< endl;="" }="" function="" to="" calculate="" team="" stats="" void="" calculateteamstats(player*="" players,="" int="" size)="" {="" output="" message="" cout="">< "\nteam="" stats:"="">< endl;="" calculate="" total="" stats="" for="" each="" team="" int="" whitepts="0," whiteast="0," whitereb="0," whitesteals="0," whiteturnovers="0," whitefouls="0;" int="" blackpts="0," blackast="0," blackreb="0," blacksteals="0," blackturnovers="0," blackfouls="0;" for="" (int="" i="0;" i="">< size; i++) { if (players[i].getteam() == "white") { whitepts += players[i].getpoints(); whiteast += players[i].getassists(); whitereb += players[i].getrebounds(); whitesteals += players[i].getsteals(); whiteturnovers += players[i].getturnovers(); size;="" i++)="" {="" if="" (players[i].getteam()="=" "white")="" {="" whitepts="" +="players[i].getPoints();" whiteast="" +="players[i].getAssists();" whitereb="" +="players[i].getRebounds();" whitesteals="" +="players[i].getSteals();" whiteturnovers="" +="">
Answered 15 days AfterMar 29, 2023

Answer To: Code for 2k game with 300 lines1. NOTE: This program must have at least 300 lines.2. Write a...

Sumit Kumar answered on Apr 14 2023
23 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here