Purchase Solution

Determine travelled distance by a projectile using Java

Not what you're looking for?

Ask Custom Question

Write a Program in Java, which determines the distance travelled by a projectile (launched from the ground) given:

1. The velocity at launch (u), and

2.The launch angle (angle of elevation) above the horizontal (A).

The program should consist of two files: Launch.java and LaunchApp.java (application).

Assume the following:

1. The angle of elevation is given in degrees and is in the range of 0 to 90.

2. Start velocity is given as a positive number.

3. Gravity (g) is equivalent to 10m/s ^ 2.

4. Ignore air resistance.

Note also that to solve the above we must carry out the following steps:

1. Calculate the vertical and horizontal components of u (the launch velocity) using the following trigonometric identities:

Vertical component of launch velocity (Vu) = u x sinA
Horizontal component of launch velocity (Hu) = u x cosA

2. Calculate the time (t) taken for the body to return to the ground using the identity:

t = (2 x Vu) / a

where a (deceleration due to gravity) is equivalent to g (10m/s ^ 2 in this case).

3. Calculate distance (s) travelled from the identity:

s = Hu x t

EXAMPLE:

A body is projected with a velocity of u = 200 m/s at an angle of elevation A = 30 degrees above the horizontal. Determine the distance travelled by the projectile.

Vu = 200 x sin30 = 100 (m/s)
Hu = 200 x cos30 = 173.2 (m/s)
t = {2 x 100) / 10 = 20 (s)
s = 20 x 173.2051 = 3464.1 (m)

Remember to write the source code for each class in a separate file which must have the same name as the class name together with the extension .java. Remember also that by convention, class names commence with a capital letter.

You should provide a well-structured solution that is easy to read. You should use meaningful identifier names and should provide useful comments.

Purchase this Solution

Solution Summary

Create Java classes to calculate the distance travelled by a projectile based on the velocity and angle.

Purchase this Solution


Free BrainMass Quizzes
Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

C# variables and classes

This quiz contains questions about C# classes and variables.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.