Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is a C++ program and I have no idea where to even start. Any help would be appreciated! A billiard ball moves across a

This is a C++ program and I have no idea where to even start. Any help would be appreciated!
A billiard ball moves across a frictionless pool table according to the laws of physics. Let us assume that the pool table is 125 units by 45 units and is oriented in the x-y plane in such a way that its lower left corner is at the origin while its upper right corner is at the point (125, 45). The x and y coordinates of the initial location of the billiard ball are entered at the keyboard. When the program commences motion, the billiard ball moves in a straight line at an angle of 45 degrees (with the positive x-axis) at a constant speed. When it strikes a rail, it banks off in such a way that the angle of reflection is also 45 degrees. Consequently, the billiard ball is always traveling in a straight line at an angle of 450, 1350, 2250, or 3150 with the positive x-axis.
In addition to prompting the user at the keyboard for the x and y coordinates of the balls initial location, prompt for a positive integer N. The program is to move the ball and report the rails as the ball strikes them. There are 4 rails: TOP, BOTTOM, LEFT and RIGHT. Suppose the user enters a value of 7 for N. Move the ball until there have been exactly 7 collisions with the rails. The output goes to the screen something like this:
TOP
RIGHT
BOTTOM
TOP
LEFT
BOTTOM
RIGHT

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

Advances In Spatial Databases 2nd Symposium Ssd 91 Zurich Switzerland August 1991 Proceedings Lncs 525

Authors: Oliver Gunther ,Hans-Jorg Schek

1st Edition

3540544143, 978-3540544142

More Books

Students also viewed these Databases questions