This project does not contain a full, runnable application
program. Instead, the only package phone
contains two classes which represent phone billing information.
The following is known about phone calls, i.e., instances or objects of class
Call
.
Call
,
giving three float
numbers as parameters.
These numbers determine the starting price, the price per minute
and the duration in minutes of the phone call represented
by the created Call
object. For instance the command
Call(0.99, 0.47, 7.5)
creates an object representing
a phone call which costs 99 cents to begin with and 47 cents per minute
(plus local network fees, paikallisverkkomaksu), and which
lasted for seven and a half minutes.
get_price
, which takes no parameters,
returns a float value representing the total cost of the phone call
represented by a call object, including local network fees. For instance,
if test_call
is a variable that refers to a call object,
then test_call.get_price()
returns the price of the call
as a float
value.
get_description
, which also takes no parameters,
returns a line of text describing a phone call object (a string).
is_more_expensive_than
takes another call object
as a parameter and returns a value indicating whether or not the call who
receives the method call is more expensive than the one given as a parameter
(i.e., a boolean value). For instance, if a
and
b
are variables that refer to phone call objects, then
a.is_more_expensive_than(b)
will return the value True
if a
has a higher total price than b
, and returns
False
otherwise.
The following is known about phone bills, i.e., instances of class
PhoneBill
.
PhoneBill
, giving
the name of the customer whose phone bill it is as a parameter. For instance:
PhoneBill("Olli-Pekka Kallasvuo")
. A phone bill object created
in this manner will not have any phone calls in it yet; these have to be
added separately.
add_call
method and giving the phone call object as a parameter. This does not return anything.
get_total_price
, which does not take any
parameters. The method returns the sum of the total costs of all the phone calls
previously added to the phone bill using the method add_call
.
get_breakdown
,
which returns a string detailing the various calls added to the phone bill.
None.
You can experiment with the classes Call
and PhoneBill
using python interpreter.
As this project is not a full program, and has no user interface, it can not be run as an application like, say, the Butler project can.