Docsity

Cell Phone Billing Algorithm - Prof. Christopher Williams, Assignments of Engineering

Toggle sidebar
bg1
HW 11 12469 Pembridge 4/9/2008 Hubbard, James 6/6
START
INPUT
X = monthly rate
Y = allowable minutes included in
monthly rate
Z = rate per minute of excess time
over monthly allowable minutes
CPM = cell phone minutes used
per month
STOP
FOR
i<12
i+1
minutes =
(minutes+CPM(i))
FOR
i<12
i+1
CPM(i) = (CPM(i)-Y)
FOR
i<12
i+1
IF
CPM(i)>0
over(i)= (over(i)+CPM(i)
over(i) = 0
T
F
FOR
i<12
i+1
Cost(i)=(X+(over(i)*Z));
OUTPUT
Month,
Minutes Used,
Cost($)
FOR
i<12
i+1
totalcost=totalcost+Cost(i)
OUTPUT
Total cost
Total minutes

Partial preview of the text

Download Cell Phone Billing Algorithm - Prof. Christopher Williams and more Assignments Engineering in PDF only on Docsity!

HW 11 12469 Pembridge 4/9/2008 Hubbard, James 6/

START

INPUT

X = monthly rate Y = allowable minutes included in monthly rate Z = rate per minute of excess time over monthly allowable minutes CPM = cell phone minutes used per month STOP

FOR

i< 12 i+ 1

minutes =

(minutes+CPM(i))

FOR

i< 12 i+ 1 CPM(i) = (CPM(i)-Y)

FOR

i< 12 i+ 1 IF CPM(i)> 0

over(i)= (over(i)+CPM(i)

over(i) = 0

T

F

FOR

i< 12 i+ 1

Cost(i)=(X+(over(i)*Z));

OUTPUT

Month, Minutes Used, Cost($) FOR i< 12 i+ 1

totalcost=totalcost+Cost(i)

OUTPUT

Total cost Total minutes