Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ on zybooks Newton's laws of motion predict the (x, y) position of an object at time T, with an initial velocity V (in ft/sec)

C++ on zybooks

image text in transcribed

Newton's laws of motion predict the (x, y) position of an object at time T, with an initial velocity V (in ft/sec) and initial angle of movement A (in degrees). Ignoring friction, the equations are y sin A) -(1/2) gT 2 where g denotes the acceleration due to gravity, assume the constant g 32.174 ft/sec 2. For example, an American football thrown at an angle A of 40 degrees, with an initial velacity V of 88 ft/sec, is at position (134.824, 48.7825) wher time T -2 seconds. On an American football field, that's about 45 yards down the field, and 16 yards up in the air Write a complete C++ program that inputs three values the initial velocity V in ft/sec (a real number), the angle A in degrees (a real number), and the timestep (a real number), in this order. The program then computes the (xy) position of the object at every timestep, starting at 0.0 seconds and stopping after 5.0 seconds. For example, suppose the inputs are the following angle and initial velocity 88.0 40.0 Your program should output the following values, where each line denotes the time T followed by the object's (x y) position at T O: (0, 0) 0.5: (33.706, 24.2609) : (67.4119, 40.4783) 1.5: (101.118, 40.6522) 2: (134.824, 48.7825) 2.5: (168.53, 40.8694) 3: (202.236, 24.9128 3.5: (235.942, 0.912695) 4: (269.648,-31.1309) 4.5: (303.354,-71.218) : (337.06, -119.349 Note that C++ provides built-in cosine and sine functions, cos(R) and sin(R). However, these functions work in radians (not degrees), so you'll need to convert A to radians using R A P/180; define Pl-3.14159. You'll also need to include the header file to gain access to the cos(R) and sin(R) functions. Assume all input values are valid, ie. are positive real numbers. PROGRAMMING INSTRUCTIONS Zyante contains a complete C++programming environment, so you are free to work here. Zyante provides 2 modes Develop" and Submit". In Develop mode, you supply the input values in the text field provided, then click Run program to run your program and see the output. This gives you a chance to develop and test your program as you see fit When you are ready to submit your program for grading, switch to Submit mode, and click Submit for grading. This will run your program against the provided test cases (some of which may be hidden). The zyante system will submit a copy of your program, along with your score. In this assignment you may submit as many times as you want without penaltyzyante records your highest score. If you fail to pass a test, keep in mind that auto-grading systems demand 100% precision. For example, your answer will be marked as incorrect if you do not output the requested values in the desired format extra spaces or missing newlines will be marked as incorrect. Compare your output to the expected output to determine whats wrong Does zyante save your work? Zyante saves the most recent copy that you submittedi.e. the last time you clicked the Run program or Submit for grading button. If you close the browser and reload the web page, this is the version of the program you will see. There is no way to go back to earlier versions, or save your current work unless you Run/Submit. For this reason, it is recommended that you save your work in an editor or word processor. You are free to work outside of zyante in a programming environment of your choioe, but you must submit for grading using the zyante system copy paste your program into zyante, switch to Submit mode, and Submit for grading. Note that different programming environments have different defaults, so it's quite possible that a program working outside of zyante will fail when run inside zyante. This is not an error in the zyante systemthis means there is a logic error in your program. The

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

Relational Database And Transact SQL

Authors: Lucy Scott

1st Edition

1974679985, 978-1974679980

More Books

Students also viewed these Databases questions

Question

i need correct answrrs 7 7 2 .

Answered: 1 week ago