1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
slega [8]
3 years ago
11

Create a class Student and another called StudentClub. StudentClub should have the fields President, Vice-President, Secretary,

and Treasurer, all of which should be pointers to a Student object. In this way, the same student could hold different offices. In addition, StudentClub should have a club members field, which should be a vector of pointers to Student objects. Your class definition should include (but not limited to) the following constructor and member functions.
StudentClub(Student* p, Student* v, Student* s, Student* t, vector m); Student* get_president() const; Student* get_vice_president() const; Student* get_secretary() const; Student* get_treasurer() const; vector get_members() const; void add_member(Student* s); int number_members()
Computers and Technology
1 answer:
salantis [7]3 years ago
3 0

Answer:

See explaination

Explanation:

StudentClub.h

#ifndef STUDENTCLUB_H_INCLUDED

#define STUDENTCLUB_H_INCLUDED

//#include <vector>

//class student

class Student

{

public:

std::string name;

Student(){}

Student(std::string name)

{

this->name=name;

}

};

//studentclub class

class StudentClub

{

Student* President=new Student();

Student* VicePresident=new Student();

Student* Secretary=new Student();

Student* Treasurer=new Student();

std::vector<Student> clubMember;

public:

StudentClub(Student* p, Student* v, Student* s, Student* t, std::vector<Student> m);

Student* get_president() const;

Student* get_vice_president() const;

Student* get_secretary() const;

Student* get_treasurer() const;

std::vector<Student> get_members() const;

void add_member(Student* s);

int number_members();

};

#endif // STUDENTCLUB_H_INCLUDED

StudentClub.cpp

#include <iostream>

#include <vector>

#include "StudentClub.h"

using namespace std;

//constructor with parameter

StudentClub::StudentClub(Student* p, Student* v, Student* s, Student* t, vector<Student> m)

{

President =p;

VicePresident=v;

this->Secretary =s;

this->Treasurer =t;

this->clubMember=m;

}

//return president

Student* StudentClub::get_president() const

{

return this->President;

}

//return vice president

Student* StudentClub::get_vice_president() const

{

return this->VicePresident;

}

//return secretary

Student* StudentClub::get_secretary() const

{

return this->Secretary;

}

//return treasurer

Student* StudentClub::get_treasurer() const

{

return this->Treasurer;

}

//return memeber

vector<Student> StudentClub::get_members() const

{

return clubMember;

}

//add member

void StudentClub::add_member(Student* s)

{

for(int i = 0; i < clubMember.size(); i++)

{

if(clubMember[i].name == s->name)

return ;

}

this->clubMember.push_back(*s);

}

//return memeber count

int StudentClub::number_members()

{

return clubMember.size();

}

main.cpp

#include <iostream>

#include <vector>

#include "StudentClub.h"

using namespace std;

int main()

{

//declarations

Student p,s,v,t,m;

//get names

cout<<"President: ";

cin>>p.name;

cout<<"VicePresident: ";

cin>>v.name;

cout<<"Secretary: ";

cin>>s.name;

cout<<"Treasurer: ";

cin>>t.name;

vector<Student> cl;

//get members

do{

cout<<"\nNew member (Q to quit): ";

cin>>m.name;

if(m.name!="Q")

cl.push_back(m);

}while(m.name!="Q");

//add to club

StudentClub club(&p,&v,&s,&t,cl);

club.add_member(&p);

club.add_member(&v);

club.add_member(&s);

club.add_member(&t);

//print details

cout<<"\n\nPresident: "<<club.get_president()->name;

cout<<"\nVicePresident: "<<club.get_vice_president()->name;

cout<<"\nSecretary: "<<club.get_secretary()->name;

cout<<"\nTreasurer: "<<club.get_treasurer()->name;

cout<<"\nTotal Members: "<<club.number_members();

return 0;

}

You might be interested in
What are possible challenges for cyber bullying
Anestetic [448]

Answer:

well, you will have your account deleted/ arrested because of cyber bullying

Explanation:

so don't!!! (hint hint XD)

6 0
3 years ago
Read 2 more answers
!!!!!HELP!!!!! (30PTS)
Inessa [10]

Answer:

B. KN

C. PP Online

Explanation:

KN is A's own software for creating slideshow presentations. However, since most people using KN are coming from using MS PP, there is the option to open PPs in KN (albeit with some fonts missing).

You can also view the file from PP Online. Just create a MS account (if you don't already have one), download the email attachment and upload it to your cloud, and you should be able to view it there.

5 0
3 years ago
Plz answer and dont put a random thing for the points
Anton [14]

<u><em>answer</em></u>: it it mostly likely to be the one that says "choose font style"

<u><em>explain</em></u>: im in advanced tech class so i think i know what this is:D

hope i helped you!:D

6 0
3 years ago
(tco 2) c++ comments are represented by which characters?
Margarita [4]
(TCO 2) In C++ terminology, (Points : 4) a ... a class object is the same as a class instance. a class object is the same as a class member. a class object is the same as a class access specifier.
4 0
3 years ago
Why was chess considered to be one of the most difficult games for computers to play well?​
telo118 [61]

Answer:

In a general sense, the answer to that is Go. The main reason for that is because the size of the board and the fact that it is empty to begin with gives the game a much more complex opening to the game. But if you were to make things equal in board size then chess is the obvious more difficult game to master.

Explanation:

6 0
3 years ago
Read 2 more answers
Other questions:
  • Jason is an aspiring filmmaker. He manages finance and makes sure that everyone is involved in the project. Which role is Jason
    12·1 answer
  • While reading his favorite outdoor sports magazine, Jeff sees an advertisement for a new camping tent that is designed for quick
    12·2 answers
  • How would a top margin be set
    7·1 answer
  • C. you have already verified the routing table entries for r1, now execute the show run | section interface command to verify vl
    11·1 answer
  • Need help . business and technology
    11·1 answer
  • Your company leases a very fast internet connection and pays for it based on usage. You have been asked by the company president
    8·1 answer
  • If you are trying to improve your budget and spending, which option would save you the most money?
    13·2 answers
  • ? I don’t understand
    8·2 answers
  • Who else doin online school
    12·2 answers
  • Draw at least 15 fabric/garment care labels on a piece of paper to be submitted the following week
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!