Intro to Python-Homework 4-INT-2240

Intro to Python-Homework 4-INT-2240

Intro to Python-Homework 4

    1. Write a program to provide information on the height of a ball thrown straight up into the air. The program should request as input the initial height, h feet, and the initial velocity, v feet per second. The height of the ball after t seconds is h vt – 16t^feet. The program should perform the following two calculations

      (a) Determine the maximum height of the ball. Note: The ball will reach its maximum

      height after v/32 seconds.

      (b) Determine the height of the ball at 0.1seconds.

      A function named getInput should be used to obtain the values of h and v, and that

      function should call a function named calculateheight to calculate the height of the ball.

      ExampleEnter the initial velocity of the ball: 34

      The maximum height of the ball is 23.06 feet.

      The height of the ball at 0.1 seconds is : 8.24 feet

  1. Objectives:Familiarize the student with:*using the if-else instruction to branch the control path;* building a complete program that solves simple real-life problems.Scenario:Consider a country where people paid tax last year. The most important tax, called the Personal Income Tax (PIT for short) had to be paid once a year, and was evaluated using thefollowing rule:1. if the citizen’s income was not higher than 85,528 dollars, the tax was equal to 18% of the income minus 550 dollars and 2 cents (this was the so-called tax relief)2. if the income was higher than this amount, the tax was equal to 14,840 dollars and 2 cents, plus 35% of the surplus over 85,528 dollars. Your task is to write a tax calculator. It should accept one floating-point value: the income.Next, it should print the calculated tax. Note: this happy country never returns money to its citizens. If the calculated tax is less thanzero, it only means no tax at all (the tax is equal to zero). Take this into consideration duringyour calculations.The code only reads one input value and outputs a result, so you need to complete it withsome smart calculations.
  2. Future Value of a Bank Deposit The following program uses the function futureValue. The function computes the balance in a savings account given the amount deposited (p), the annual rate of interest (r), the number of times interest is compounded per year (n), and the number of years that interest accrues (t).

    def futureValue(p, r, n, t) . Have a main function that will get P, r, n and t. Then pass the values to futureValue(p, r, n, t).  Print out A(final deposit)

    interest.PNG

Answer Preview-Intro to Python-Homework 4-INT-2240

Intro to Python-Homework 4-INT-2240

$3.00

Posted

in

by

Tags: