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

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

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

Post by answerhappygod »

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;
}
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply