Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

More Books

Students also viewed these Databases questions

Question

Determine the roles of spatial layout and functionality.

Answered: 1 week ago