{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}


Assignment_7_Bonus - The launch angle is set by the user...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Page 1 of 2 Assignment 7 Bonus Question Code the final question from the midterm, test, and submit your code and output and you can receive up to 4 marks on your worst assignment. The question is as follows: A student is setting up a robot for visitors who come to campus day to play a game of darts as shown above. Before setting up the robot they are simulating the game using C++ (and not RobotC) and their knowledge of projectile motion. The target, shown below, is a round piece of cork with a 2 mm diameter wire separating the inner circle (worth 10 points) from the outer circle (worth only 5 points). If the dart hits the wire, it bounces and won't stick in the board, and therefore does not score any points. The diagrams below give the dimensions for the target and the formula for the range of a projectile. The launch speed is constant at 3 meters per second and the direction angle is zero degrees.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: The launch angle is set by the user. Both the direction angle and the launch angle can only be set to +/- 2 degrees (human error!) Page 2 of 2 a) Use the diagrams to show the variables and formulas that you will be using so we can follow your code. b) Write a function that receives a launch angle in degrees and returns the range for the dart. You may hard-code any constants. c) Professor Bedi has written a function that returns a random number. Its use is shown below. double x = random ( -1.5, 3.0); // x will be between -1.5 and 3. Write a main function that: prompts the user for his/her name for each of 10 darts o prompts for, and reads a launch angle o adjusts for the random error in both the direction and launch angles o calulates the x and y positions of the landing point ( You must use your function! ) o updates the score prints out the name and the total score....
View Full Document

{[ snackBarMessage ]}