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
Match the IP Protections Patent, Copyright and Trademark into the following cases:
Vesna [10]

Answer:

A) copyright

B) copyright

C)Trade mark

D) copyright

E)Patent

Explanation:

Patent can be regarded as a form of intellectual property which helps the owner of an invention to others to sell or use the invention for some period of time. Example of this is a patent that protect microwave oven.

trademark is form of intellectual property, this could be inform of symbols, words that differentiate the product of a party from another. Example of this is a bite of apple that represents apple products.

Copyright can be regarded as a legal right given to those that owns a intellectual property which gives him/her right to copy and exclude others from reaping from where they did not sow. The owner get exclusive right to reproduce the copy.

Below is the match of the intellectual property with the examples.

a. books, poems<> Copyright

b. music, movies, paintings<> Copyright

c. company logo<> Trademark

d. software<>Copyright

e. combinations of materials to make drugs<> patent

8 0
3 years ago
The ______ is the information center that drivers need to refer to when they're NOT scanning the road.
Arisa [49]

Answer:

C. instrument panel

Explanation:

In order to be able to operate your vehicle safely, you must know the functions and locations of all the interior mechanisms of your car.

The instrument panel contains gauges which include the following:

Speedometer, which indicates speed in both miles and kilometers per hour

Tachometer, which indicates rotations in the engine in revolutions per minute (RPMs)

Odometer, which indicates the total number of miles your car has been driven since it was manufactured

Fuel gauge, which shows the fuel level in your car's fuel tank

Oil gauge, which shows oil level

5 0
3 years ago
Write a program that accepts a whole number as input, multiplies that number by 12, and then outputs the product.
lesya692 [45]

try:

   num = int(input("Enter a number: "))

   print(12*num)

except ValueError:

   print("Please enter a number!")

I wrote my code in python 3.8

6 0
3 years ago
Read 2 more answers
Whats the recommended amount of dedodated wam<br>i can have in a server
Scorpion4ik [409]
Hi! The recommended amount of RAM that you should have is 6gb and above.
5 0
3 years ago
What type of Windows server has Active Directory installed and is responsible for allowing client computers access to domain res
Basile [38]

Answer:

Domain controller                    

Explanation:

  • A domain controllers is a server which acknowledges authentication requests and validates users access on the computer network in order to use the resources.
  • This is done by the domain controller by verifying the username and password.
  • It also allows user to access the other domain and also access the resources of other domain.
  • For example there is a network of multiple computers and each computer requires authentication i.e user is asked to provide the username and password.
  • Authenticating every computer and managing is not easy so a computer is appointed this task of authentication other computers.
  • This computer  is called domain controller which can easily maintain these authentication details of the users.
  • The authentication information (login details) of users, computers and shared resources is saved in Active Directory database.
  • If a user requests access to the resource via login then the login details (username and password) of the user should match with that stored in the Active Directory in order to grant access to the user.
  • Domain controller enables resources sharing and is good for large networks and provides with improved security.
4 0
3 years ago
Other questions:
  • In cell F29, use an IF function to display the correct Shipping Charge, based on the amount of the Discounted Total. If the Disc
    9·1 answer
  • _______ are created under ________, similar to how you create individual files within a broader file folder
    9·2 answers
  • With Google Alerts you can Group of answer choices
    13·1 answer
  • ________ errors may indicate that an attacker is trying to send invalid data to the server. 404 303 500 512
    11·1 answer
  • If you're using your keyboard, what actions are you most likely performing in Access?
    15·2 answers
  • You have been asked to create a query that will join the Production.Products table with the Production.Categories table. From th
    6·1 answer
  • Microsoft PowerPoint is popular software that allows you tocreate slides, handouts, notes, and outlines.
    12·1 answer
  • Where does the list of incoming mail appear in gmail
    13·2 answers
  • Which are examples of ribbon customizations?
    11·1 answer
  • PROCEDURE: Therapeutic infusion of saline solution with 5% dextrose IV, 500 ml for dehydration, lasting 48 minutes. what is the
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!