1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
#include <iostream>
using namespace std;
class Basketball {
private:
float FTAttempted, FTMade, FGAttempted, FGMade, Rebounds, Assists, Steals, BlockedShots, GamesPlayed;
void calcFTP() { ((FTAttempted/FTMade)*100); }
void calcFGP() { ((FGAttempted/FGMade)*100); }
void calcPPG() { (((FTMade*1) + (FGMade*2)) / GamesPlayed);}
void calcRPG() { (Rebounds/GamesPlayed); }
void calcAPG() { (Assists/GamesPlayed); }
void calcSPG() { (Steals/GamesPlayed); }
void calcBPG() { (BlockedShots/GamesPlayed); }
public:
void setData(float FTA, float FTM, float FGA, float FGM, float R, float A, float S, float B, float G);
Basketball(float FTA =0, float FTM=0, float FGA=0, float FGM=0, float R=0, float A=0, float S=0, float B=0, float G=0)
{setData(FTA, FTM, FGA, FGM, R, A, S, B, G);}
float getFTP() {return calcFTP();}
float getFGP() {return calcFGP();}
float getPPG() {return calcPPG();}
float getRPG() {return calcRPG();}
float getAPG() {return calcAPG():}
float getSPG() {return calcSPG();}
float getBPG() {return calcBPG();}
~Basketball() {cout << "End of THIS object!\n";}
};
void Basketball::setData(float FTA, float FTM, float FGA, float FGM, float R, float A, float S, float B, float G)
{
FTAttempted=FTA;
FTMade=FTM;
FGAttempted=FGA;
FGMade=FGM;
Rebounds=R;
Assists=A;
Steals=S;
BlockedShots=B;
GamesPlayed=G;
}
int main()
{
}
|