Package phone :: Module call :: Class Call
[hide private]
[frames] | no frames]

Class Call

object --+
         |
        Call

The class Call represents billing information of phone calls. Each phone call is defined by its duration, its price per minute, and the price to start the call. A phone call object's state is immutable once the object has been created.

The class's methods automatically take into account the network usage component of a phone calls (paikallisverkkomaksu). These are assumed to be constants irrespective of location.

Instance Methods [hide private]
 
__init__(self, start_price, minute_price, duration)
Creates a new phone call object with the given attributes.
boolean
is_more_expensive_than(self, another_call)
Determines if the phone call has a higher total cost than another given phone call.
float
get_price(self)
Returns the full price of the phone call, including network usage costs (paikallisverkkomaksu).
string
get_description(self)
Returns a string description of the phone call, detailing the duration and price of the call.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  NETWORK_START_COST = 0.0099
  NETWORK_MINUTE_COST = 0.0199
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, start_price, minute_price, duration)
(Constructor)

 

Creates a new phone call object with the given attributes.

Parameters:
  • start_price (float) - the start price of the phone call in euros, not including network usage fees
  • minute_price (float) - the price per minute of the phone call in euros, not including network usage fees
  • duration (float) - the length of the phone call, in minutes
Overrides: object.__init__

is_more_expensive_than(self, another_call)

 

Determines if the phone call has a higher total cost than another given phone call.

Parameters:
  • another_call (call object) - a phone call to compare this one to
Returns: boolean
Value indicating if this call was more expensive than the given one

get_price(self)

 

Returns the full price of the phone call, including network usage costs (paikallisverkkomaksu).

Returns: float
full price of call

get_description(self)

 

Returns a string description of the phone call, detailing the duration and price of the call.

Returns: string
a string description of the call