Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider the following containers: List<T> Map<K,V, KCompare> Queue<T> SortingMa

ID: 644911 • Letter: C

Question

Consider the following containers:

List<T>

Map<K,V, KCompare>

Queue<T>

SortingMachine<T, TCompare>

Stack<T>

StaticArray<T, int lb, int ub>

Building a record by hand

Item #1:

Pick a container component (from the list above) to store statistics kept about a basketball player as shown to the right.

Enter your answer by typing:

"Item #1"

The container you selected from the list above and if it is a template class the C++ code you would use to create a named instance

A justification for your selection

NAME: last name, first name, MI

FGM, FGA: field goals made, attempted

FTM, FTA: free throws made, attempted

3FGM, 3FGA: three-point field goals made, attempted

OREB, DREB: offensive rebounds, defensive rebounds

AST: assists

STL: steals

BLK: blocks

TO: turnovers

PF: personal fouls

MIN: minutes played

Item #2:

Given the class ArenaData to the right. Pick a container component that would allow efficient look up of a particular arena given its name.

Enter your answer by typing:

"Item #2"

The container you selected from the list above and if it is a template class the C++ code you would use to create a named instance

A justification for your selection

List<T>

Map<K,V, KCompare>

Queue<T>

SortingMachine<T, TCompare>

Stack<T>

StaticArray<T, int lb, int ub>

Building a record by hand

Explanation / Answer

C++ Program:

#include<iostream>

#include<cmath>

#include<iomanip>

using namespace std;

//defining a class Player

class Player

{

private:

char name[51];

double fta;

double ftm;

double fga;

double fgm;

double r;

double a;

double s;

double b;

double g;

double ftperc;

double fgperc;

double pointpgame;

double rpgame;

double apgame;

double spgame;

double bpgame;

void calcFtperc() {ftperc = ((ftm/fta)*100);}

void calcFgperc() {fgperc = ((fgm/fga)*100);}

void calcPointpgame() {pointpgame = ((ftm*1)+(fgm*2));}

void calcAvgr() { rpgame = (r/g);}

void calcAvga() { apgame = (a/g);}

void calcAvgs() { spgame = (s/g);}

void calcAvgb() { bpgame = (b/g);}

public:

Player(double ta=0,double tm=0,double ga=0,double gm=0,double r2=0,double a2=0,double s2=0,double b2=0,double g2=0) {setData(ta,tm,ga,gm,r2,a2,s2,b2,g2);}

void setData(double ta,double tm,double ga,double gm,double r2,double a2,double s2,double b2,double g2);

~Player(void) {cout << " End of This object! ";}

double changestats();

double getFtperc() const {return ftperc;}

double getFgperc() const {return fgperc;}

double getPointpgame() const {return pointpgame;}

//averages

double getAvgr() {return rpgame;}

double getAvga() {return apgame;}

double getAvgs() {return spgame;}

double getAvgb() {return bpgame;}

};

void Player::setData(double ta,double tm,double ga,double gm,double r2,double a2,double s2,double b2,double g2)

{

fta=ta; ftm=tm;

fga=ga; fgm=gm;

r=r2; a=a2;

s=s2; b=b2;

g=g2;

}

void main(void){

Player obj;

char playername[51];

double playerfta, playerftm, playerfga, playerfgm, playerr, playera, players, playerb, playerg;   

cout << " Please enter player's name: ";

cin >> playername;

cout << " Please enter player's FTA: ";

cin >> playerfta;

cout << "Please enter player's FTM: ";

cin >> playerftm;

cout << "Please enter player's FGA: ";

cin >> playerfga;

cout << "Please enter player's FGM: ";

cin >> playerfgm;

cout << "Please enter player's rebound's: ";

cin >> playerr;

cout << "Please enter player's assist's: ";

cin >>playera;

cout << "Please enter player's steals: ";

cin >> players;

cout << "Please enter player's blocked shots: ";

cin >> playerb;

cout << "Please enter number of games: ";

cin >> playerg;

cout << obj.getFgperc();

cout<< obj.getFgperc();

cout << obj.getPointpgame();

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote