Prob-4 Write a computer program that computes the duration of a projectile\'s fl
ID: 3639040 • Letter: P
Question
Prob-4 Write a computer program that computes the duration of a projectile'sflight and its height above the ground when it reaches the target. As
part of your solution, write and call a function that displays instruc-
tions to the program user.
Problem Constant
G = 32.17 // gravitational constant
Problem Inputs
float theta // input - angle (radians) of elevation
float distance // input - distance (ft) to target
float velocity // input - projectile velocity (ft/sec)
Problem Outputs
float time // output - time (see) of flight
float height // output - height at impact
Relevant Formulas
time= distance/(velocity * cos(theta))
g x time2
height = (velocity x sin(theta) x time )-{ (g * time^2)/2}
Try your program on these data sets.
Inputs Data Set 1 Data Set 2
Angle of elevation 0.3 radian 0.71 radian
Velocity 800 ft/sec 1,600 ft/ sec
Distance to target 11,000 ft 78,670 ft
Prob-8 In shopping for a new house, you must consider several factors. In this
problem the initial cost of the house, estimated annual fuel costs, and
annual tax rate are available. Write a program that will determine the
total cost after a five-year period for each set of house data below. You
should be able to inspect your program output to determine the "best
buy."
Initial House Cost Annual Fuel Cost Tax Rate
$175,000 $2500 0.025
$200,000 $2800 0.025
$210,000 $2050 0.020
To calculate the house cost, add the fuel cost for five years to the initial
cost, then add the taxes for five years. Taxes for one year are computed
by multiplying the tax rate by the initial cost. Write and call a function
that displays instructions to the program user and another function that
computes and returns the house cost given the initial cost, the annual
fuel cost, and the tax rate.