There are 3 tables given. We must construct a header file named hidden.h.
......................................................
footballer (class)
# name : string
# club : string
#goals : int
# bonusSalary : double
____________________________
<<constructor>> +
footballer(n : string, c : string, g : int)
+
salary()
.......................................................
......................................................................
___________________________________
divisionOne
<<constructor>> +
divisionOne(n : string, c : string, g : double) -
salary()
.....................................................................
.....................................................................
___________________________________
divisionTwo
<<constructor>> +
divisionTwo(n : string, c : string, g : double) -
salary()
.......................................................................
This is my header for classA. Please correct if my code has any errors.
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
|
#include <iostream>
#include <string>
using namespace std;
class footballer{
public: //member function
footballer(string n, string c, int g) //constructor
{
string n = name;
string c = club;
int g = goals;
}
double salary();
protected:
string name;
string club;
int goals;
double bonusSalary;
};
class divisionOne : public footballer {
public:
string n = name;
string c = club;
int g = goals;
double salary()
{
bonusSalary = 1000.00 + (goals*10000.00);
}
private:
double salary();
};
class divisionTwo : public footballer {
public:
string nameN;
string clubC;
int goalG;
double salary()
{
bonusSalary = goals*5000.00;
}
private:
double salary();
};
|