Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- The Ball Class:
- The data that defines a ball is given below:
- x: its x position
- y: its y position
- r: its radius
- dx: its speed in the x direction
- dy: its speed in the y direction
- a. What is a constructor?
- [2]
- Write two constructors for this class:
- one that has no default values;
- my lecturers answer:
- Ball ( int xx, int yy, int rr, float dx, float dy)
- {
- this.x = xx;
- this.y = yy;
- this.r = rr;
- this.dx = dx;
- this.dy = y;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement