77 956
Assignments Done
98,4%
Successfully Done
In August 2019

Answer to Question #47089 in Other Programming & Computer Science for ami

Question #47089
Develop a program that allows one to control the movement of a ball across the screen.
The ball can move on straight lines only, that is, up, down, left, or right. Pressing the
arrow keys on the keyboard changes the ball's location.
1. Develop a data representation for the current position of the ball. The position is
best described with a pair of positive integers.
2. Develop a data representation for velocity of the ball. You may assume that the
ball always moves exactly 10 pixels at a time but remember that velocity also
includes the direction of the movement.
3. Develop a data representation for the ball.
4. The function ball-image is written for you. It consumes (the representation of)
a ball and produces a rectangle of 300 x 300 pixels with a red dot (diameter 10
pixels) placed at the ball's position.
5. Design the function ball-next, which consumes (the representation of) a ball
and create a ball that represents where it will be after one "tick."
6. Design a function ball-change, which consumes a ball
Expert's answer

Not answered

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions