Question: Create a class named SmartPhonePlan that extends the CellPhonePlan class and represents an advanced cell phone plan specifically designed for smartphones. This class inherits all

Create a class named SmartPhonePlan that extends the CellPhonePlan class and represents an advanced cell phone plan specifically designed for smartphones. This class inherits all the features of the CellPhonePlan and introduces data tracking capabilities to accommodate the data usage needs of smartphone users. The class is designed with the following properties and methods:
Properties:
max_data: The maximum amount of data (in gigabytes) the plan allows at any time. This represents the starting total of data available to the user at the beginning of the plan's billing cycle.
data_used: The total amount of data (in gigabytes) consumed. This is deducted from max_data to determine the remaining data available. At the beginning this should be 0.
def __init__(self, network:dict, minutes:int, messages:int, data:int):
"""
Initializes a new SmartPhonePlan instance with specified network, minutes, messages, and data.
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.
data (int): The total data (in gigabytes) provided by the plan.
"""
def use_data(self, data:int):
"""
Consumes a specified amount of data from the plan's current total.
Args:
data (int): The amount of data (in gigabytes) to be consumed.
Raises:
RuntimeError: If the phone plan does not have enough data for consumption.
NotImplementedError: If the receiving phone cannot receive messages.
"""
def reset(self):
"""
Resets the plan's `minutes`,`messages`, and `data` properties to their maximum values.
This method does not require arguments as it resets the plan's minutes, message counts, and data to `max_minutes`,
`max_messages`, and `max_data`, respectively.
"""
Make sure you include the PhonePlan and CellPhonePlan classes in your submitted code. Example:
class PhonePlan:
...
class CellPhonePlan(PhonePlan):
...
class SmartPhonePlan(CellPhonePlan):
...

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!