Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is a two-part lab. In part A, you will use existing C/C++ library functions to solve a simple scientific problem. In part B you

This is a two-part lab.

In part A, you will use existing C/C++ library functions to solve a simple scientific problem. In

part B you will take a problem description and solve it using, in part, a function you design and

implement.

Specifications:

Part A This part looks a including Functions in your program

Write a program that outputs the range of a projectile. The formula for computing this range is:

range = sin(2.0 * angle) * velocity2 / gravity

where:

angle = the angle of the projectiles path (in radians)

velocity = the initial velocity of the projectile (in meters-per-second)

gravity = the earths constant acceleration due to gravity of 9.8 meters-persecond-

per-second

range = the projectiles range (in meters)

The takeoff angle must be input by the user of your program in degrees (0 to 90) so you must

convert this angle to its radian equivalent. This is necessary because the trigonometric functions,

sin(x), cos(x), etc., require an angle argument (parameter) expressed in radians. The expression

for converting an angle in degrees to its equivalent in radians is:

Angle(in radians) = angle(in degrees) * p/180.0

where the universal constant, p, to 7 places of accuracy is:

p = 3.1415926

So, for example, an angle of 45o would become,

45 * 3.1415926 / 180.0 = 0.7853975 radians.

Your interactive input followed by your computed range output should look something like this:

Takeoff Angle (in degrees):

Initial Velocity (meters per second):

Projectile Range (in meters):

The C/C++ predefined library, , contains functions for the trigonometric sin operation

and the exponent operation (pow). You will need to open the header file to see how to

use these functions (i.e., what parameter(s) they require, what the type(s) of these parameters are,

and the type of the value returned).

As a minimum, test your program with the following test cases (NOTE: Your program

does NOT need to display these in the table form shown below)::

Takeoff Angle Initial Velocity Range

30 100

30 200

45 100

45 200

60 100

60 200

90 100

90 200

Part B

Solve problem 6.12 on page 273 of your text. For your solution to this problem the

function, calculateCharges(), specified in the problem description, must be implemented

in (a) separate file(s) for the file containing the main() function that calls this function

(multiple times).

One sample output looked like this:

Car Hours Charge

1 1.5 $2

2 4 $2.5

3 24 $10

TOTAL 29.5 $14.5

Test this program with at least three (3) sets of input data

Deliverable(s):

Turn in the source listings of the programs you develop for both parts of this lab and the results

you get from running the programs against the test cases specified above. Be sure to properly

document your programs per the specifications in the previous labs. By now you should be getting a

feel for what information is necessary for fellow programmers who need to read and understand your

programs purpose and how it accomplishes the job.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

More Books

Students also viewed these Databases questions

Question

Discuss the importance of asset management.

Answered: 1 week ago

Question

2. What appeals processes are open to this person?

Answered: 1 week ago

Question

4. How would you deal with the store manager?

Answered: 1 week ago