Question: need it in an hour!!!!!!!!!!!!!! The Class RingTone represents a downloadable sound that plays typically on cell phones or computers. Consider the following diagram. The
need it in an hour!!!!!!!!!!!!!!
The Class RingTone represents a downloadable sound that plays typically on cell phones or computers. Consider the following diagram. The instance shown on the left were created by saying:
| // A RingTone that sounds like a bell and // lasts for 2 seconds RingTone rt( "bell", 2 ); |
Ringtone objects have the members: my_Kind( a string that describes the sound of this ringtone ) my_Length ( an int that is t he elapsed time in seconds of this ringtone when played ) For the constructors shown above, here is the class definition (.h)
| Class Diagram | Class Definition (.h file) | |||
| class RingTone { public: RingTone( std::string kind, int length ); int getLength() const; std::string getKind() const; void play(); private:int my_Length; // the length of this tone when // played std::string my_Kind; // what does this tone sound // like??? }; |
Based on the information shown here, a possible implementation (.cpp) for RingTone is shown below.
| RingTone::RingTone( std::string kind, int length ) : my_Kind( kind ), my_Length( length ) { // EMPTY } int RingTone::getLength() const { return( my_Length ); } std::string RingTone::getKind() const { return( my_Kind ); } void RingTone::play() { cout |
Based on this implementation of RingTone, define and implement the class Cellphone (a .h file and a .cpp file). A Cellphone instance represents a portable telephone that uses a ringtone. The relationship between Cellphone and RingTone is shown in the class diagram below.
Make sure your definition of Cellphone supports the following kinds of constructors:
| // a Cellphone with a "gong" ringtone that // lasts for 5 seconds Cellphone gongPhone; // a Cellphone with a "piano" ringtone that // lasts for 2 seconds Cellphone c( "piano", 2 ); |
In addition, make the operation on Cellphone defined as:
void Cellphone::receiveCall();
This operation should correctly ring the phone's RingTone.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
