In: Computer Science
1. Imagine that the IRA is giving a stimulus package in the COVID-19 season. The package amount is determined by the number of adults in the family and the total amount of salary the family gets.
Each adult will get 1200 dollars if the total salary is 100000 or less.
Each adult will get 800 dollars if the total salary is 150000 or less.
Write a python program to ask the user the number of adults in the family and the total number of family salary and determine the total amount of stimulus package the IRA will provide for that family.
Hi,
Hope you are doing fine. I have written the above program in python adhering to all the conditions mentioned in the problem. The logic and the program is explained clearll using the comments (highlighted in bold) provided above each line.
Program:
#Taking the number of adults in the family from user and
converting it to integer as the input is always taken in string
format
number_of_adults=int(input("Please enter the number of adults in
the family: "))
#Taking the total salary of the family from user and
converting it to integer as the input is always taken in string
format
total_salary=int(input("Please enter the total salary of family:
"))
#if the total salary is less than or equal to 100000
then package is given at 1200 per adult
if total_salary<=100000:
ira=number_of_adults * 1200
# else if total salary is less than or equal to 150000 then
package is given at 800 per adult. This will only execute if total
salary is between 100001 and 150000
elif total_salary<=150000:
ira=number_of_adults * 800
#Note that there is no condition mentioned for ira greater than 150000 in the question.
#Printing the package provided by the ira
print("The total amount of stimulus package the IRA will provide
for the family is: {}".format(ira))
Executable code snippet of the program from jupyter notebook:
Output: