Results 1 to 4 of 4
  1. #1
    Robster is offline Member
    Join Date
    Nov 2011
    Posts
    2
    Rep Power
    0

    Default Illegal start of expression

    Hey there,

    I'm in a spot of bother and really struggling with finding what the problem,

    Java Code:
     import javax.swing.JOptionPane;
       public class ProcessingSpeed {
          public static void main (String args[]) {;
             String output = "\n";
          
             int arraySize = Keyboard.getInt("enter the amount of processors");
             String[] processors = new String[arraySize];
             int[] clockspeed = new int[arraySize];
             int[] databus = new int[arraySize];
             int[] cachememory = new int[arraySize];
             int[] points = new int[arraySize];
             String[] stars = new String[arraySize]; 
             int[] clockpoints = new int[arraySize];
             for (int loop = 0; loop<arraySize; loop++) {;
             
                processors[loop] = Keyboard.getText("Please enter the processor");
                clockspeed[loop] = Keyboard.getInt("please enter the clock speed of processor");
                   databus[loop] = Keyboard.getInt("please enter the lines on data bus");
               cachememory[loop] = Keyboard.getInt("please enter the amount of cache memory");
             //============================================================================
             //calculate clockspeed points
           
             
                if (!(clockspeed[] < 2)) {;
                   clockpoints[] == 10;
             
                else if (!(clockspeed[] > 2 || clockspeed[] <= 3))
                   clockpoints[] = 20;
             
                else  (!(clockspeed[] > 3))
                   clockpoints[] = 30;
                };// end if
    								
             //============================================================================
             // calculate cache memory points
             
             
                double pointsforcache = cachememory[]/10;
                String pointsforcache0dp = String.format("%0f" , pointsforcache);
                int pointc = pointsforcache0dp;
             //=============================================================================
             //calucate total points
             
                int points = clockpoints[] + pointc + databus;
             
             //=============================================================================
             //calculate stars given
             
                if (!(points[] <=50)){;
                   stars[] = "*";
                };// end if 
             
                if (!(points[] > 50 && points[] <=150)){;
                   stars[] = "**";
                }; // end if
             
                if (!(points[] > 200)){;
                   stars[] = "***";
                };//end if
             
             
             }// end loop
          //================================================================================
             output += processors[] + " " + points[] + "" + stars[];
             Screen.display(output, "processor");
          }//end main
       }//end class

    The errors i get when i complile is this;

    ----jGRASP exec: javac -g ProcessingSpeed.java

    ProcessingSpeed.java:24: illegal start of type
    if (!(clockspeed[] < 2)) {;
    ^
    ProcessingSpeed.java:24: illegal start of expression
    if (!(clockspeed[] < 2)) {;
    ^

    i get the same error for the rest of the program.


    Any help would be appreciated, its been bothering me for the past 6 hours.
    Last edited by Robster; 11-25-2011 at 09:06 PM. Reason: made mistake on copy and paste

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,560
    Blog Entries
    7
    Rep Power
    21

    Default Re: Illegal start of expression

    What's that semi colon doing there at the end of line #24?

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    Robster is offline Member
    Join Date
    Nov 2011
    Posts
    2
    Rep Power
    0

    Default Re: Illegal start of expression

    it was just one of the mistakes i have made here which i would have fixed as i continued to sort it. But i can't seem to find or understand why i am getting this error.

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,560
    Blog Entries
    7
    Rep Power
    21

    Default Re: Illegal start of expression

    I gave it a bit closer look; your code is full of errors, e.g. you're using those square brackets [] all over the place and they don't belong there. There are spurious semi colons everywhere and that Keyboard (class?) isn't defined anywhere; if I were you I'd start again because this code is beyond repair ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Another Illegal Start of Expression
    By miss_peaches in forum New To Java
    Replies: 2
    Last Post: 05-11-2011, 04:41 PM
  2. Illegal start of expression
    By lodaSchitt in forum New To Java
    Replies: 2
    Last Post: 04-28-2011, 10:04 PM
  3. Illegal start of expression
    By Nigel in forum New To Java
    Replies: 5
    Last Post: 03-11-2011, 12:42 PM
  4. Illegal Start of an Expression
    By ddatta8 in forum New To Java
    Replies: 3
    Last Post: 12-20-2008, 08:40 PM
  5. illegal start of expression
    By razmyasdfg in forum CLDC and MIDP
    Replies: 2
    Last Post: 07-27-2008, 10:44 PM

Posting Permissions

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