Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please write the program in c++. i have also added lab8_3.cpp. so while coding please follow the pattern or style given on lab8_3.cpp. Thank you

image text in transcribed

image text in transcribed

please write the program in c++. i have also added lab8_3.cpp. so while coding please follow the pattern or style given on lab8_3.cpp.

Thank you

Help D 2017 1x (New Tab E Post-LX Exercise 3: Snowball Fight! EXTREME SHOOTING! Download lab8 3.cpp and attach the completed file to your submission. Now that we have the basics of snow throwing design optimization, we can now go a little bit further to terrorize the Spartans even more. Recall the formula to measure the distance in Exercise 2 distance- sin(2ayg Now instead of using a catapult, we are going to use a snow cannon! For this we are going to do a nested loop to go through all the combination of angles and velocity and see how much energy we need to shoot the snowballs to east lansing. Recall the kinetic energy formula. KE-(1/2) vomass Cannon Constraints The angle can range from 0 to 90 degrees The velocity can range from 0 to 50 m/s The mass of the snowball is 0.25 kg The cannon is limited to using 100 joules (energy) . Write a program to find the BEST ANGLE and the BEST VELOCITY which yields the FURTHEST LAUNCH DISTANCE within the ENERGY LIMITATION. 1. You should cycle through all possible angles (0 through 90, incrementing by 1) 2. You should cycle through all possible velocities (0 through 50, incrementing by 1) 3. For each newAngle and newvelocity, calculate the distance for that angle 4. If a new distance is greater than the bestDistance AND the energy needed to launch the snowball is below 100 joules, save this newAngle as bestangle and newVelocity as bestVelocity Testing Ensure your output looks like this: (using 3,14 es pi and 9.8 as ) bash-4.1S ./lab8 3 The angle and velocity to launch the snowball farthest is 45 degrees and 28 m/s which requires 98 joules and will launch the snowball 80 meters Hints 1. Convert the angle to radians and avoid integer division 2. Remember to initialize bestDistance 3. Be careful when squaring values, the operator will not work 2

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 And Expert Systems Applications 19th International Conference Dexa 2008 Turin Italy September 2008 Proceedings Lncs 5181

Authors: Sourav S. Bhowmick ,Josef Kung ,Roland Wagner

2008th Edition

3540856536, 978-3540856535

More Books

Students also viewed these Databases questions

Question

Explain the process of MBO

Answered: 1 week ago