Results 1 to 2 of 2
  1. #1
    mikle81 is offline Member
    Join Date
    Jul 2012
    Posts
    4
    Rep Power
    0

    Default Eclipse Breakout Program

    Hi,

    I am currently trying to teach myself Java using eclipse and course material provided free from Stanford, the course is CS106a.

    Ive been getting on fine but am now getting an unexpected error at the very start of the next assignment. The code is below, everything up to the run method is provided as a start to the program so can only assume it is correct. However whenever I try to add a new method eclipse keeps giving me error messages that to be honest I don't understand or know how to fix.

    The errors are below,

    - Multiple markers at this line[/COLOR]
    - Syntax error on token "void", @ expected[/COLOR]
    - Syntax error, insert "enum Identifier" to complete EnumHeader


    I expect it will just be something obvious I'm missing but would be grateful if someone could help point it out to me.



    Thanks.




    /*
    * File: Breakout.java
    * -------------------
    * Name:
    * Section Leader:
    *
    * This file will eventually implement the game of Breakout.
    */

    package Assignment3;

    import acm.graphics.*;
    import acm.program.*;
    import acm.util.*;

    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;

    public class Breakout extends GraphicsProgram {

    /** Width and height of application window in pixels */
    public static final int APPLICATION_WIDTH = 400;
    public static final int APPLICATION_HEIGHT = 600;

    /** Dimensions of game board (usually the same) */
    private static final int WIDTH = APPLICATION_WIDTH;
    private static final int HEIGHT = APPLICATION_HEIGHT;

    /** Dimensions of the paddle */
    private static final int PADDLE_WIDTH = 60;
    private static final int PADDLE_HEIGHT = 10;

    /** Offset of the paddle up from the bottom */
    private static final int PADDLE_Y_OFFSET = 30;

    /** Number of bricks per row */
    private static final int NBRICKS_PER_ROW = 10;

    /** Number of rows of bricks */
    private static final int NBRICK_ROWS = 10;

    /** Separation between bricks */
    private static final int BRICK_SEP = 4;

    /** Width of a brick */
    private static final int BRICK_WIDTH =
    (WIDTH - (NBRICKS_PER_ROW - 1) * BRICK_SEP) / NBRICKS_PER_ROW;

    /** Height of a brick */
    private static final int BRICK_HEIGHT = 8;

    /** Radius of the ball in pixels */
    private static final int BALL_RADIUS = 10;

    /** Offset of the top brick row from the top */
    private static final int BRICK_Y_OFFSET = 70;

    /** Number of turns */
    private static final int NTURNS = 3;

    /* Method: run() */
    /** Runs the Breakout program. */


    public void run()
    {

    setSize(700, 500); // Sets the size of the canvas


    private void brickCreator() - Multiple markers at this line
    - Syntax error on token "void", @ expected
    - Syntax error, insert "enum Identifier" to complete EnumHeader

    {

    // body of method

    }



    }

    }

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,755
    Rep Power
    19

    Default Re: Eclipse Breakout Program

    Obviously had a bouncy finger, so I'll close this duplicate.l
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Breakout Assignment from CS106a
    By tech8462 in forum New To Java
    Replies: 13
    Last Post: 10-09-2011, 03:38 AM
  2. Making a breakout Game
    By JavaIsSoEasy?? in forum Java Gaming
    Replies: 0
    Last Post: 03-05-2011, 10:52 AM
  3. Need help with Breakout game
    By tfitz666 in forum New To Java
    Replies: 9
    Last Post: 03-22-2010, 05:26 AM
  4. Breakout Game code help.
    By Ceasar in forum New To Java
    Replies: 6
    Last Post: 10-10-2009, 01:30 AM
  5. Another Breakout question
    By jumpstart in forum New To Java
    Replies: 3
    Last Post: 07-29-2009, 04:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •