Answered step by step
Verified Expert Solution
Question
1 Approved Answer
COMP163 Falling Rocks Project This project should be done by teams of two students. Be sure to put the names of both students in the
COMP163 Falling Rocks Project This project should be done by teams of two students. Be sure to put the names of both students in the top comments of all three Java files. You may do the program by yourself if you wish. Create the following three classes with the indicated class instance variables and methods. Each class must be in its own file. Rock Several objects of the Rock class will move down the screen. xPos int horizontal position of the object yPos nt vertical position of the object size int size of the object in pixels color java.awt.Color color of the object public Rock( int xLoc, int yLoc, int radius) Initialize class instance variables. Set color to whatever you like (except white) public int getyPos() Returns the vertical position of the object, yPos. public void setyPos (int y) Set the yPos of the Rock object. public int getxPos() Returns the horizontal position of the Rock, xPos. public void drop (int howFar) Move the object's position down by howFar pixels. Add howFar to yPos. public void drawRock (java.awt.Graphics screen) Draw the object at the current xPos and yPos as the upper left corner Dodger A Dodger object moves left and right at the bottom of the screen trying to avoid the Rocks. xPos int horizontal position of the object yPos int vertical position of the object size int size of the object in pixels color java.awt.Colorcolor of the object maxX int maximum value the xPos can be public Dodger int xLoc, int yLoc, int heightWidth, int maxx) Initialize class instance variables. Set color to anything except white. page I of 3
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started