Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java: Templates for the code: y = [vo t sin(0) - 1 9t?]+ Problem Description: You are to create a program that simulate the

In Java: image text in transcribed
image text in transcribed
Templates for the code:
image text in transcribed
image text in transcribed
y = [vo t sin(0) - 1 9t?]+ Problem Description: You are to create a program that simulate the launching of two projectiles at a given angle, height, and initial velocity. These projectiles stop moving once they hit the ground and you are to calculate the distance between them. GUI is NOT required Projectile motion equations: X x displacement x = [vot.cos(6)] + xo Xo: initial x displacement Y: y displacement Yo: initial y displacement Vo: initial velocity t: time 8: initial angle g gravitational constant Keep in mind that the X and Y displacement is the distance from the projectiles origin at a given time stamp. See example below. Program Requirements: 1. The program shall use the first quadrant of a 2D coordinate plane. 2. The program shall have 2 projectiles named Hare and Hound 3. The program shall have the projectiles follow projectile motion equations, 4. The Hare shall have a random initial angle ranging from 0 to 90 degrees. 5. The Hare shall have a random initial velocity ranging from 70 to 120 meters per second 6. The Hare shall have a random initial height ranging from 400 to 1000 meters, 7. The Hound shall have a random initial angle ranging from 0 to 90 degrees. 8. The Hound shall have a random initial velocity ranging from 50 to 150 meters per second 9. The Hound shall have a starting height of 600 meters. 10. The Hare shall stop moving once it hats the ground 11. The Hound shall stop moving once it hits the ground. 12. The program shall calculate the distance between the Hare and the Hound once they have both hit the ground. 13. The program shall start both Hare and Hound on the left side of the screen (x = 0). 14. The program shall define ground as constant horizontal line. Homework Requirements: 1. The program shall run 2 iterations. 2. An Iteration shall consist of: a. Setting up the Hare and hound (see Program Requirements 4-9) b. Firing the Hare and Hound to follow projectile motion, i. The program shall display the flight path in time intervals of 5 seconds c. Once the Hare and Hound hit the ground, the program shall display the distance between the Hare and the Hound 3. Iteration 1 shall have a ground shall defined as y=0. 4. Iteration 2 shall have a ground shall defined as y = 120 5. The program shall have 2 classes Manager and Projectile. 6. The Projectile class shall handle the location and movement 7. The Manager class shall handle the 2 iterations using Projectile objects. public class Manager public static void main(String[] args) { //run each iteration public static double randomfrom (int low, int high) ( double randNum - B; randNum - (Math.randon()*(high-low) + low); return rand Num; 1 public static String distanceBetween(Projectile hare, Projectile hound) { //get the distance between the projectiles 3 public static void runIteration(int iterationum, int ground) //create the projectiles with their randomized inputs System.out.println("Iteration 1 + iteration Num); //start time System.out.println(" Hare: "); 1/while the hare hasn't reached the ground, move it 1/restart time System.out.println(" Hound: "); 7/while the hound hasn't reached the ground, move it //print out the distance between them } public class Projectile { //create attributes for the projectiles (take them from the hw doc) //don't forget to generate setters and getters //write the constructor so it takes in the inputs for each projectile and puts the //values in the right attributes public Projectile(/"inputs here...*/) { } public void move(double time) { 1/just put the equations from the hw doc in here //Setters and Getters... y = [vo t sin(0) - 1 9t?]+ Problem Description: You are to create a program that simulate the launching of two projectiles at a given angle, height, and initial velocity. These projectiles stop moving once they hit the ground and you are to calculate the distance between them. GUI is NOT required Projectile motion equations: X x displacement x = [vot.cos(6)] + xo Xo: initial x displacement Y: y displacement Yo: initial y displacement Vo: initial velocity t: time 8: initial angle g gravitational constant Keep in mind that the X and Y displacement is the distance from the projectiles origin at a given time stamp. See example below. Program Requirements: 1. The program shall use the first quadrant of a 2D coordinate plane. 2. The program shall have 2 projectiles named Hare and Hound 3. The program shall have the projectiles follow projectile motion equations, 4. The Hare shall have a random initial angle ranging from 0 to 90 degrees. 5. The Hare shall have a random initial velocity ranging from 70 to 120 meters per second 6. The Hare shall have a random initial height ranging from 400 to 1000 meters, 7. The Hound shall have a random initial angle ranging from 0 to 90 degrees. 8. The Hound shall have a random initial velocity ranging from 50 to 150 meters per second 9. The Hound shall have a starting height of 600 meters. 10. The Hare shall stop moving once it hats the ground 11. The Hound shall stop moving once it hits the ground. 12. The program shall calculate the distance between the Hare and the Hound once they have both hit the ground. 13. The program shall start both Hare and Hound on the left side of the screen (x = 0). 14. The program shall define ground as constant horizontal line. Homework Requirements: 1. The program shall run 2 iterations. 2. An Iteration shall consist of: a. Setting up the Hare and hound (see Program Requirements 4-9) b. Firing the Hare and Hound to follow projectile motion, i. The program shall display the flight path in time intervals of 5 seconds c. Once the Hare and Hound hit the ground, the program shall display the distance between the Hare and the Hound 3. Iteration 1 shall have a ground shall defined as y=0. 4. Iteration 2 shall have a ground shall defined as y = 120 5. The program shall have 2 classes Manager and Projectile. 6. The Projectile class shall handle the location and movement 7. The Manager class shall handle the 2 iterations using Projectile objects. public class Manager public static void main(String[] args) { //run each iteration public static double randomfrom (int low, int high) ( double randNum - B; randNum - (Math.randon()*(high-low) + low); return rand Num; 1 public static String distanceBetween(Projectile hare, Projectile hound) { //get the distance between the projectiles 3 public static void runIteration(int iterationum, int ground) //create the projectiles with their randomized inputs System.out.println("Iteration 1 + iteration Num); //start time System.out.println(" Hare: "); 1/while the hare hasn't reached the ground, move it 1/restart time System.out.println(" Hound: "); 7/while the hound hasn't reached the ground, move it //print out the distance between them } public class Projectile { //create attributes for the projectiles (take them from the hw doc) //don't forget to generate setters and getters //write the constructor so it takes in the inputs for each projectile and puts the //values in the right attributes public Projectile(/"inputs here...*/) { } public void move(double time) { 1/just put the equations from the hw doc in here //Setters and Getters

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

Step: 3

blur-text-image

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

Database 101

Authors: Guy Kawasaki

1st Edition

0938151525, 978-0938151524

More Books

Students also viewed these Databases questions