A mobile service provider has two data plans for its customers:

Silver plan: For $29.99 a month, 4 gigabytes are provided. Additional data costs $10 per gigabyte.
Gold plan: For $49.99 a month, 8 gigabytes are provided. Additional data costs $5 per gigabyte.

For both plans, the additional data is rounded up to an integral number of gigabytes. For example, if the additional data is 2.1 gigabytes, it is rounded up to 3 gigabytes, and the cost is $30 for the silver plan and $15 for the gold plan. Write a program that displays a menu of choices.

Respuesta :

The program is an illustration of built-in functions and conditional statements.

Built-in functions are functions that have specific roles defined in them, while conditional statements are statements whose execution depends on the truth values of the condition.

The program in Python, where comments are used to explain each line is as follows:

import math

#This prints the menu

print("Menu\n1.- Silver plan\n2. Gold plan")

#This gets input for the plan from the user

selection = int(input("Select a plan: "))

#This gets the additional data from the user

additional_data = float(input("Additional data: "))

#This rounds up the additional data to the next integer

additional_data = math.ceil(additional_data)

#If selection is 1

if selection == 1:

   #This calculates the additional cost and the total cost

   additional_cost = 10 * additional_data

   total = additional_cost + 29.99

#If selection is 2

elif selection == 2:

   #This calculates the additional cost and the total cost

   additional_cost = 5 * additional_data

   total = additional_cost + 49.99

#For other inputs, the selection is considered invalid

else:

   print("Invalid selection")

#This prints the additional and the total costs, for selections 1 and 2

if selection == 1 or selection == 2:

   print("Additional cost:",additional_cost)

   print("Total cost: {:.2f}".format(total))

At the end of the program, the appropriate costs are printed for valid selections.

Read more about similar programs at:

https://brainly.com/question/25210352