Design a class called Orchestra. An Orchestra has a maximum size and a list of Musicians that currently play in the orch

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

Design a class called Orchestra. An Orchestra has a maximum size and a list of Musicians that currently play in the orch

Post by answerhappygod »

Design a class called Orchestra. An Orchestra has a maximum size
and a list of Musicians that currently play in the orchestra.
Musician objects can join the Orchestra as long as the orchestra is
not full.
Your Orchestra class must provide the following public methods:
Orchestra(); // default constructor
Orchestra(int size); // constructor for an orchestra of given
size
// returns the number of musicians who have joined the orchestra
int get_current_number_of_members();
// returns true if any musician in the orchestra plays the
specified instrument
// otherwise returns false
bool has_instrument(std::string instrument);
Musician *get_members(); // returns the array of members of the
orchestra
// returns true and adds new musician to the orchestra if the
orchestra is not full
// otherwise returns false
bool add_musician(Musician new_musician); ~Orchestra();
You may add any other methods and any state variables you want,
but the methods listed above must be available and public. The
default Orchestra size is 0.
Write an Orchestra.h and Orchestra.cpp files to declare and
implement the Orchestra class. Write a main-1-2.cpp file that tests
all of your methods (behaviours) function correctly. Please submit
all 3 files.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply