Answered step by step
Verified Expert Solution
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
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 2Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started