Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(+5) Write a Python program that determines cell phone charges (see problem #1 i

ID: 3879338 • Letter: #

Question

(+5) Write a Python program that determines cell phone charges (see problem #1 in Lab 00 with the stipulation that the user can use their phone < 300 minutes.   Recall that problem 1 in Lab 00 reads as follows:

Suppose your cell phone carrier charges you a monthly fee of $30.00 for up to 300 minutes and $0.45 for each additional minute after the first 300.   Assuming you used your phone for x minutes with x > 300, the total monthly fee would be?

If you used your phone for <= 300 minutes then the charge is $30.00 Assume the user enters a positive value for the number of minutes

               30 + (x -300) * .45 correct answer

Use the following template

A = 30 #CONSTANT fee for <= 300 minutes
m = int(input("Enter the number of minutes "))
c = 0 # initialize cost variable
if (m > 300):        # minutes > 300
    # calculations here to compute the solution
    # use the correct answer provided
   
print(" the cost for ", m, " minutes is ", c )
else:    # here m is <= 300           # s <= 0
   
print(" the cost for ", m, ' minutes is ', A )

Explanation / Answer

A = 30 #CONSTANT fee for <= 300 minutes
m = int(input("Enter the number of minutes "))
c = 0 # initialize cost variable
if (m > 300):        # minutes > 300
    # calculations here to compute the solution
    # use the correct answer provided
   c = 30 + (m-300) * 0.45
    print " the cost for " , m , " minutes is " , c
else:    # here m is <= 300           # s <= 0
    print " the cost for " , m, " minutes is " , A

Output:

Enter the number of minutes 340

the cost for 340 minutes is   48.0

Enter the number of minutes 299

the cost for 299 minutes is   30