Question

In: Computer Science

QUESTION 1: Imagine that the IRA is giving a stimulus package in the COVID-19 season. The...

QUESTION 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.

QUESTION 2:

Write a program that will ask the user length and width of a right triangle and find the area of the right-angled triangle. The formula for finding the area of a right-angle triangle is

ab/2. Also, find out the result if you calculate as (ab)/2. Is it the same? If it is same, why it is the same. If it is not the same, why it is not the same.

Solutions

Expert Solution

ANSWER 1:

PYTHON CODE:

# ask the user the number of adults

adults = int(input('Enter the total number of adults in the family: '))

# ask the user the total family salary

salary = float(input('Total number of family salary: '))

# total_amount variable

total_amount = 0

# Each adult will get 1200 dollars if the total salary is 100000 or less.

# salary > 0 and salary < 100000

if(salary>=0 and salary<=100000):

    total_amount = adults * 1200

# Each adult will get 800 dollars if the total salary is 150000 or less.

# salary > 100000 and salary < 150000

if(salary>100000 and salary<=150000):

    total_amount = adults * 800

# print the total amount by format

print('Total amount {} of stimulus package the IRA will provide for that family.' .format(total_amount))

PYTHON CODE SCREENSHOT:

OUTPUT:

ANSWER 2:

Find out the result if you calculate as (ab)/2. Is it the same? If it is same, why it is the same?

Answer:
Case 1: When we are calculate the area of the right-angled triangle by formula ab/2.
The operator *, and / have the same operation precedence.
a*b is executed first, because it appears to be there first then ab/2
For example: a = 5 , b = 6
area = a*b/2
area = 5*6/2
area = 30/2
area = 15.0
Case 2: When we are calculate the area of the right-angled triangle by formula (ab)/2.
(a*b) is regular parentheses executed first,then (a*b)/2
For example: a = 5 , b = 6
area = (a*b)/2
area = (5*6)/2
area = 30/2
area = 15.0
So both are give the same result.

PYTHON CODE:

# ask the user length of a right triangle

length = float(input('Enter the length of a right triangle: '))

# ask the user width of a right triangle

width  = float(input('Enter the width of a right triangle: '))

# find the area of the right-angled triangle

# The formula for finding the area of a right-angle triangle is ab/2

area1 =  length * width / 2  

# The formula for finding the area of a right-angle triangle is (ab) /2

area2 = (length * width) / 2  

# print the area calculating by ab/2

print("Area of the right-angled triangle is:",area1);  

# print the area calculating by (ab)/2

print("Area of the right-angled triangle is:",area2);

PYTHON CODE SCREENSHOT:

OUTPUT:

NOTE: If you don't understand any step please tell me.


Related Solutions

1. Imagine that the IRA is giving a stimulus package in the COVID-19 season. The package...
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...
this is a python code: QUESTION 3: Imagine that the IRA is giving stimulus package in...
this is a python code: QUESTION 3: Imagine that the IRA is giving 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...
Show the impact of Covid-19 on the Australian economy. How did the stimulus package impact the...
Show the impact of Covid-19 on the Australian economy. How did the stimulus package impact the Australian economy? Explain your answer with the help of aggregate demand and supply model. What are implications of Covid-19 on the government budget.
Australia’s stimulus package to cushion the economic impact of COVID-19 pandemic is nearly 15% of 2019...
Australia’s stimulus package to cushion the economic impact of COVID-19 pandemic is nearly 15% of 2019 GDP. Notable initiatives include: JobKeeper Payment ($1,500/fortnight), JobSeeker Payment ($550/fortnight), and Coronavirus Supplement ($550/fortnight). Using the AD-AS framework, explain how these initiatives will help the economy deal with the economic fallout from COVID-19.(the answer is expected to be around 200 words.)
the zambian government aprroved a k8 billion ($439 million) COVID-19 bond economic stimulus package to alleviate...
the zambian government aprroved a k8 billion ($439 million) COVID-19 bond economic stimulus package to alleviate the pandemics impact on the economy.to this effect, the central bank issued K2.67 billion COVID -19 bond on the 27th of july,2020.assuming that the central bank issued a 5 year bond with par value of K100.00 at a price of K77.35 with a 11% coupon rate, advise,as an investment consultant a client who wants to invest K50,000; 1) The expected annalised fixed coupon income...
The risk of the stimulus monetary policy in the covid-19
The risk of the stimulus monetary policy in the covid-19
the risk of the stimulus fiscal policy in the Covid-19
the risk of the stimulus fiscal policy in the Covid-19
Would the COVID-19 stimulus be expanding the money supply?
Would the COVID-19 stimulus be expanding the money supply?
Question: the economic impact of another Covid-19 relief package in the USA. Do we need it?...
Question: the economic impact of another Covid-19 relief package in the USA. Do we need it? How can it stimulate the economy? Does it will help stabilize the economy or it bring debt to the country? answers base on articles " Is $1 Trillion Enough for a New Economic Relief Package?"
It is the start of the Flu Season and we are still in the Covid-19 disease's...
It is the start of the Flu Season and we are still in the Covid-19 disease's clutches. Financially what has happened to the healthcare industry to this date? What are the future financial implications for healthcare organizations if, now, we have two separate but similar diseases confronting us? There is a whole lot to consider operationally for both healthcare organizations and for communities. Part of being an effective healthcare manager is a proactive approach that anticipates events that impact your...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT