Q1.

Create a list called scores with 79,84,92,75,84,100, 83, 91, 88,84, 69, 98,84, 91,84

Write a python program that asks the user for a positive integer input and stores it as number. If the input number is a negative number or zero, print an error message. If the input is positive, then your program should calculate the number of times the input number appears in the list scores.

Print the result with an appropriate message.

Test your program with positive and negative inputs as well as zero. Submit your program result for input 84.

Q2.

In 2019, a small company's revenue was $2,750,400, and its EPS (Earnings per Share) was $0.68. The company is planning for annual revenue growth of 9.5%. Its EPS, on the other hand, are expected to grow at 12.0% annually. Calculate and print the companys expected (planned) revenue and earnings per share for 2019 and the next seven years. Show the results as a table with 3 columns, with headings for each column. (See the example output below). Do not show any decimals in the revenue column. The EPS should be displayed with two decimal places.

year revenue EPS
2019 2750400 0.68
  • Hint 1: This question does not require any keyboard input.
  • Hint 2: You do not need to use any Lists.
  • Hint 3: you may use the tab key to create columns.
  • Hint 4: You may use the int() function to convert a floating-point number to an integer. Show revenue without any decimals in your report.

Q3.

This program requires the use of a sentinel because you do not know how many inputs you need to process before-hand. You need to detect that condition at run time. You detect the end of input through the sentinel. (In this program, the sentinel is 9999). The sentinel value should be chosen such that the sentinel value is NOT expected to be a possible value in the input stream. Ask for an input integer from the user, repeatedly. Read the user input and store

  • Calculate the sum of all the non-negative inputs
  • Calculate the sum of all the negative inputs.
  • If the user enters 9999 (the sentinel), it indicates the end of the input stream.
  • The program should also keep track of the total number of inputs, excluding the sentinel.
  • Display the following 4 outputs (with appropriate messages) and terminate the program.
    • the number of inputs processed (excluding the sentinel)
    • the sum of positive inputs,
    • the sum of the negative inputs, and
    • the count of the number of inputs that are zero.
  • Submit the results for the following input stream (your program should work for any integer input stream)
12, -7, 0, -12, 27, 19, 10, -15, 29, 9999

Q4.

This question is an extension of Q3 in programming project 1. In project 1 Q3, you calculated the total amount due for one item of clothing. In this question, you need to extend the program you wrote before to calculate the total amount due for all the shopping items together. Make use of earlier work.

In Morristown, clothing that costs $15.00 or less has a lower sales tax rate of 1.7%. Otherwise, the sales tax is 7.65% of the purchase price. Mrs. Warren went shopping and bought several items of clothing, whose prices are: 76.50, 14.75, 39.00, 22.50, 12.95, 8.99, 29.95

Write a python program in which you calculate the total due amount from Mrs. Warren and print your answer with an appropriate message.

  • Hint 1: make use of your work/code from programming project 1
  • Hint 2: No need to get these prices as keyboard input.

Q5.

This question is an extension of Q4 from programming project-1, where you calculated the income tax due on a given taxable income. Modify that program so that it can calculate income tax for any number of incomes. Submit your results for the following taxable incomes:

27500.00, 75650.00, 317500.00, 137325.00, 268600.00, 84625.00, 37655.00

For each income, calculate the income tax due and display the taxable income and the income tax with an appropriate message. Your program should print one line for each taxable income.

Hint 1: make use of your work/code from programming project 1 ; Hint 2: There is no need to get taxable incomes as keyboard input. Define a list and initialize the list with the taxable incomes.

2020 Federal Income Tax Schedule (married, joint return)
Taxable Income Tax Rate Tax at Lower limit Tax at Upper limit
0 <= income <= 19750 0.10 0.00 1975.00
19750 < income <= 80250 0.12 1975.00 9235.00
80250 < income <= 171050 0.22 9235.00 29211.00
171050 < income <= 326600 0.24 29211.00 66543.00
326600 < income <= 414700 0.32 66543.00 94735.00
414700 < income <= 622050 0.35 94735.00 167307.50
622050 < income 0.37 167307.50

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.