212k views
0 votes
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 = 300 #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 above

# 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 )

1 Answer

3 votes

Answer:

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

A = 30 #CONSTANT fee for <= 300 minutes

m = int(input("Enter the number of minutes "))

c = 0 # initialize cost variable

if (m>300):

c = 30 + ((m - 300) * 0.45) #Cost when the minute is greater 300

print("The cost for ", m, " minutes is $",c )

else:

print("The cost for ", m, " minutes is $",A )

Step-by-step explanation:

c = 30 + ((m - 300) * 0.45) #Cost when the minute is greater 300

First 300 is subracted from the given minute to get the extra minute, and then the extra minute is multiplied by $0.45 after which it is added to the constant of $30 for the 300 minutes

User Lex Webb
by
4.2k points