Question: Write C++ code to create a class for a cell phone service called DigitalMessage. The class must include a field for the price of the

Write C++ code to create a class for a cell phone service called DigitalMessage. The class must include a field for the price of the message plus get and set methods for that field. Then, DERIVE two new classes from the DigitalMessage class. The first class must be called VoiceMail and the second class must be called TextMessage. Include a default constructor for each class (you don't need any parameterized constructors).

The VoiceMail class must contain a float field for length of the message in minutes, as well as get and set methods for that field. The set method must populate the price of the message based on the length of the message: 10 cents per minute (be sure to use a named constant).

The TextMessage class must contain an int field for the number of characters in the message, as well as get and set methods for that field. The set method must populate the price of the message based on the length of the message: 3 cents per character (be sure to use a named constant).

Write a program that instantiates at least one object from each of the two derived classes. Include code and output to demonstrate that your classes and all of the get/set methods are working properly.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!