A member ID number will be assigned to each new member inserted in the list, starting from 111, which is set up as a glo
Posted: Sat May 14, 2022 7:47 pm
A member ID number will be assigned to each new member inserted
in the list, starting from 111, which is set
up as a global constant right before the
class definition.
WRITE THE IMPLEMENTATION OF addMember 1 and 2. class member
provided below.
class has a member variable:
#include<iostream>
using namespace std;
class Member {
// member variables
int ID;
string firstName;
string lastName;
int points;
public:
// default constructor
Member() {
firstName = "";
lastName = "";
}
// overloaded constructor
Member(string firstName, string lastName) {
ID = 0;
points = 0;
this->firstName = firstName;
this->lastName = lastName;
}
// function addPoints
void addPoints(int points) {
this->points += points;
}
// function setID
void setID(int ID) {
this->ID = ID;
}
// accessor function of ID
int getID() {
return ID;
}
// accessor function of firstName
string getFirstName() {
return firstName;
}
// accessor function of lastName
string getLastName() {
return lastName;
}
// accessor function of points
int getPoints() {
return points;
}
in the list, starting from 111, which is set
up as a global constant right before the
class definition.
WRITE THE IMPLEMENTATION OF addMember 1 and 2. class member
provided below.
class has a member variable:
#include<iostream>
using namespace std;
class Member {
// member variables
int ID;
string firstName;
string lastName;
int points;
public:
// default constructor
Member() {
firstName = "";
lastName = "";
}
// overloaded constructor
Member(string firstName, string lastName) {
ID = 0;
points = 0;
this->firstName = firstName;
this->lastName = lastName;
}
// function addPoints
void addPoints(int points) {
this->points += points;
}
// function setID
void setID(int ID) {
this->ID = ID;
}
// accessor function of ID
int getID() {
return ID;
}
// accessor function of firstName
string getFirstName() {
return firstName;
}
// accessor function of lastName
string getLastName() {
return lastName;
}
// accessor function of points
int getPoints() {
return points;
}