Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The objective of this part of the lab is to create documentation using Javadoc f

ID: 3528943 • Letter: T

Question

The objective of this part of the lab is to create documentation using Javadoc for the Paddle Ball Game project from week 5. The following documentation requirements must be met. 1. All commentary must use standard JavaDoc comments and tags. 2. For every class add a class level comment including the author and the purpose of the class. 3. Where one class heavily depends on the use of an object from another class, provide a link to the other class using the @see tag. 4. For every method, add a method level comment which includes information on the purpose of the method, the method parameters, and the result returned by the method. 5. Use the javadoc command to generate HTML files for your project. 6. Use the browser to view your generated documentation to verify that all the required information for all the classes is included. Consult the document provided describing how to export JavaDoc comments from Eclipse. When your documentation is complete, turn in one of the following depending on what your instructor requires: 1. Print outs of all the documentation pages from the browser. 2. A Zip file containing all the documentation pages. Deployment Create a JAR file for the Paddle Ball Game project from week 5. The JAR file must contain all the class files needed to make the Paddle Ball Game work. Consult the document provided describing how to export a JAR file from Eclipse. To test if you have made your JAR file correctly, double click on your JAR file using Windows Explorer. The Paddle Ball Game should start running. If you are on Citrix, you will need to copy your game to a local computer before you can successfully execute it. Here's my Code: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Ball { int x, y, side, Xinc, Yinc; int strikeCount = 0; public Ball(int size){ side = size; //Sets the ball Size from Main x = y = 30; // Starts the ball at (30, 30) Xinc = 3; Yinc = 4; } public void drawBall(Graphics g2){ g2.setColor(Color.green); g2.fillOval(x, y, side, side); } public void UpdateBallPosition(int topPaddleHit, int leftPaddleHit){ x += Xinc; y += Yinc; if (x >= 675) Xinc = -Xinc; if (y >= 675) Yinc = -Yinc; if (x <= 0){ Xinc = 3; strikeCount += 1; } if (y <= 0){ Yinc = 4; strikeCount += 1; } if (y <= 30 && topPaddleHit >= (x - 40) && topPaddleHit <= (x + 40)) Yinc = 3; if (x <= 30 && leftPaddleHit >= (y - 40) && leftPaddleHit <= (y + 40)) Xinc = 4; if (strikeCount == 3){ JOptionPane.showMessageDialog(null, "Click OK to Start Over", "Game Over", JOptionPane.INFORMATION_MESSAGE); strikeCount = 0; } } } import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Square{ public int x, y, x2, y2, side1, side2; public Square(int width, int height){ side1 = width; side2 = height; x = 15; y = 15; } public void drawSquare(Graphics g2){ g2.setColor(Color.green); g2.fillRect(x, y, side1, side2); } public void UpdateHorPosition(int x, int y){ this.x = x - (side1 / 2); this.y = 15; if (x <= 70) this.x = 30; if (x >= 630) this.x = 590; } public void UpdateVertPosition(int x, int y){ this.x = 15; this.y = y - (side2 / 2); if (y <= 70) this.y = 30; if (y >= 630) this.y = 590; } } import java.awt.*; import java.awt.event.*; import javax.swing.*; public class PaddleGame extends JPanel implements ActionListener, MouseListener, MouseMotionListener{ Ball ball; //Creates a ball object from Ball.java Square topPaddle, leftPaddle; //Creates the paddle objects from Squaare.java JFrame frame; private Timer myTimer; public int topPaddleHit, leftPaddleHit; public PaddleGame(){ ball = new Ball(25);// Sets Ball Size topPaddle = new Square(80, 15); leftPaddle = new Square(15, 80); frame = new JFrame(); frame.setTitle(" Pong"); frame.add(this); frame.setResizable(false); frame.setSize(705, 730); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); frame.addMouseMotionListener(this); frame.addMouseListener(this); frame.setVisible(true); myTimer = new Timer(10, this); myTimer.setInitialDelay(1000); myTimer.start(); } public void actionPerformed(ActionEvent e){ //Every time the timer hits this happens ball.UpdateBallPosition(topPaddleHit, leftPaddleHit); this.repaint(); //This method calls the paintComponents method } public void paintComponent(Graphics g2){ g2.setColor(Color.black); g2.fillRect(0, 0, 700, 700); ball.drawBall(g2); topPaddle.drawSquare(g2); leftPaddle.drawSquare(g2); } public void mouseDragged(MouseEvent me){ } public void mouseMoved(MouseEvent me){ int x, y; x = me.getX(); y = me.getY(); topPaddleHit = me.getX(); leftPaddleHit = me.getY(); topPaddle.UpdateHorPosition(x, y); leftPaddle.UpdateVertPosition(x, y); this.repaint(); } public void mouseClicked(MouseEvent me){ myTimer.stop(); JOptionPane.showMessageDialog(null, "Press OK to Resume", "Game Paused", JOptionPane.INFORMATION_MESSAGE); myTimer.setInitialDelay(100); myTimer.start(); } public void mouseEntered(MouseEvent e){ myTimer.setInitialDelay(100); myTimer.start(); } public void mouseExited(MouseEvent e){ myTimer.stop(); } public void mousePressed(MouseEvent e){ } public void mouseReleased(MouseEvent e){ } public static void main(String[] args) { PaddleGame test = new PaddleGame(); } }

Explanation / Answer

public class BallGameTest { public static void main (String [] args) { BallGame world = new BallGame("Ball game"); world.setVisible(true); world.move( ); } } import java.awt.Graphics; import java.awt.event. *; public class BallGame extends MovingBall { private Paddle myPaddle = new Paddle(FRAME_WIDTH, FRAME_HEIGHT); public BallGame (String title) { super(title); addKeyListener(new KeyList( )); } public void paint (Graphics g) { super.paint(g); if (isContact( )) { myBall.bounce( ); } else { myPaddle.paint(g); } } public boolean isContact( ) { if (myPaddle.area( ).contains(myBall.getPosition( ))) { return true; } else { return false; } } // inner class for the listener private class KeyList extends KeyAdapter { public void keyPressed (KeyEvent k) { if (k.getKeyCode( ) == KeyEvent.VK_LEFT) { myPaddle.moveLeft( ); } if (k.getKeyCode( ) == KeyEvent.VK_RIGHT) { myPaddle.moveRight( ); } } // ends method keyPressed } // ends private class KeyList } // ends class BallGame import java.awt. *; import javax.swing. *; import java.awt.event. *; public class MovingBall extends JFrame { protected final int FRAME_WIDTH = 240; protected final int FRAME_HEIGHT = 320; protected Ball myBall = new Ball(FRAME_WIDTH, FRAME_HEIGHT); public MovingBall (String title) { super(title); setSize(FRAME_WIDTH, FRAME_HEIGHT); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public void paint (Graphics g) { super.paint(g); myBall.paint(g); } public void move ( ) { while (true) { myBall.move( ); repaint( ); try { Thread.sleep(50); } catch (InterruptedException e) { System.exit(0); } } // ends while } // ends move } // ends MovingBall import java.awt. *; public class Ball { private final int RADIUS = 10; private Point pos; private Color ballColour = Color.red; private int yChange = 2; private int xChange = 1; private int height, width; public Ball (int frameWidth, int frameHeight) { width = frameWidth; height = frameHeight; pos = new Point ( ); pos.x = (int)(Math.random( ) * (width - RADIUS)) + RADIUS; pos.y = (int)(Math.random( ) * (height/2 - RADIUS)) + RADIUS; } public void paint (Graphics g) { g.setColor(ballColour); g.fillOval(pos.x - RADIUS, pos.y - RADIUS, 2 * RADIUS, 2 * RADIUS); } public void move ( ) { if (pos.y
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote