Question: Create a class named CellPhonePlan that extends the PhonePlan class and represents a cell phone plan for a cell phone. This class comes with all

Create a class named CellPhonePlan that extends the PhonePlan class and represents a cell phone plan for a cell phone. This class comes with all the functionality of the basic PhonePlan with the added ability to track the total and currently consumed SMS messages within the plan. The class is designed with the following properties and methods:
Properties:
max_messages: The maximum number of messages the plan allows at any time. This represents the starting total of messages available to the user at the beginning of the plan's billing cycle.
messages: The total number of messages consumed. This is calculated as max_messages -.
def __init__(self, network:dict, minutes:int, messages:int):
"""
Initializes a new PhonePlan instance with a specified network, minutes, and messages.
Args:
network (dict): A dictionary mapping phone numbers to phone objects.
minutes (int): The total minutes provided by the plan.
messages (int): The total SMS messages provided by the plan.
"""
def send_message(self, phone_number:str):
"""
Sends a message, reducing either plan's available message count by one for a successfully sent and received message.
Check if the other phone has enough messages before sending the message by checking the message property of the
other phone's phone plan. Keep in mind the other phone may not have a plan. If the other phone does not have a plan,
consider it as if it has enough messages to receive a message.
Args:
phone_number (str): The phone number to send the message to.
Raises:
RuntimeError: If either phone does not have enough messages left or if the phone number is not in the network.
NotImplementedError: If the receiving phone cannot receive messages.
"""
def reset(self):
"""
Resets the plan's `minutes` and `messages` properties to their maximum values.
This method does not require arguments as it resets the plan's minute and message counts to `max_minutes` and
`max_messages`, respectively.
"""
Make sure you include the PhonePlan class code in your submitted code. Example:
class PhonePlan:
...
class CellPhonePlan(PhonePlan):
...

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 Programming Questions!