Package phone :: Module phone_bill :: Class PhoneBill
[hide private]
[frames] | no frames]

Class PhoneBill

object --+
         |
        PhoneBill

The class PhoneBill represents customers' phone bills. Each phone bill object is associated with a number of phone calls whose prices combine to form the total cost of the phone bill.

Instance Methods [hide private]
 
__init__(self, customer)
Creates a new phone bill with the given customer and no calls made yet.
 
add_call(self, new_call)
Adds a new phone call to this phone bill.
float
get_total_price(self)
Returns the price total of this phone bill, i.e., the sum of the prices of the phone calls added to this bill.
string
get_breakdown(self)
Returns an item-by-item listing of the phone calls included in the bill.

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, customer)
(Constructor)

 

Creates a new phone bill with the given customer and no calls made yet.

Parameters:
  • customer (string) - a customer name
Overrides: object.__init__

add_call(self, new_call)

 

Adds a new phone call to this phone bill.

Parameters:
  • new_call (call object) - a phone call made by the customer whose bill this is.

get_total_price(self)

 

Returns the price total of this phone bill, i.e., the sum of the prices of the phone calls added to this bill.

Returns: float
call price sum

get_breakdown(self)

 

Returns an item-by-item listing of the phone calls included in the bill.

Returns: string
a multi-line string listing the details of this phone bill.