Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python! please help! def discount(age, major, is_in_military, gpa): #OK #discounts are all 20% max #CS majors gpa 3.5 or higher #students in military or 65+

Python! please help!

image text in transcribedimage text in transcribeddef discount(age, major, is_in_military, gpa): #OK #discounts are all 20% max #CS majors gpa 3.5 or higher #students in military or 65+ regardless of major #discounts cannot be stacked if (age >= 65 or is_in_military == True): #Checking if senior or in the military return True elif major == "Computer Science": #checking for CS student if gpa >= 3.5: return True else: return False else: return False

def calculate_cost(plan, num_minutes, num_text): #OK basic_cost = 0.0 total_cost = 0.0 if plan == "basic": basic_cost = 15 free_minutes = 100 free_text = 1000 price_add_minute = 1.50 price_add_text = 0.75 elif plan == "standard": basic_cost = 20 free_minutes = 175 free_text = 1500 price_add_minute = 1.25 price_add_text = 0.5 elif plan == "premium": basic_cost = 25 free_minutes = 250 free_text = 2000 price_add_minute = 1 price_add_text = 0.25 total_cost += basic_cost if num_minutes > free_minutes: total_cost += (num_minutes - free_minutes)*(price_add_minute) if num_text > free_text: total_cost += (num_text - free_text)*(price_add_text) return total_cost

def cost_efficient_plan(age, major, is_in_military, gpa, num_minutes, num_text): best_plan = calculate_cost("basic", num_minutes, num_text) std_cost = calculate_cost("standard", num_minutes, num_text) pre_cost = calculate_cost("premium", num_minutes, num_text) basic_cost = 0 if discount(age, major, is_in_military, gpa): basic_cost = basic_cost * 0.8 if basic_cost

#Not sure if cost_efficient_plan works completely....

Plan Basic Standard Premium Cost Per Month ($) $15 $20 $25 Free Calls minutes 100 175 250 Free Texts 1000 1500 2000 Price for additional Price for additional calls per minute (S) text (S) 1.50 1.25 0.75 0.5 0.25

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

what are signs of NPD

Answered: 1 week ago