Here is my code

 package prg420.week5;                  //Creates the package
 import java.util.*;
 class Grades {                          //Creates the class for the variables

    private double grade1;
    private double grade2;
    private double grade3;
    private double grade4;
    private double grade5;

    public void setGrade1(double val) { grade1 = val; }
    public void setGrade2(double val) { grade2 = val; }
    public void setGrade3(double val) { grade3 = val; }
    public void setGrade4(double val) { grade4 = val; }
    public void setGrade5(double val) { grade5 = val; }

    public double getGrade1() { return grade1; }
    public double getGrade2() { return grade2; }
    public double getGrade3() { return grade3; }
    public double getGrade4() { return grade4; } 
    public double getGrade5() { return grade5; }


   public class floatArray {

        public static void main(String[] args) {

    float[] floatArray = new float[]{ 95.2, 93.5, 88.0, 84.5,57.2};         
        }       
     IntegerSet s = new IntegerSet();
   }
        for(int i=0; i<5; i++);                 
        public (double) calculateAvg();
    {
        return (getGrade1() + getGrade2() + getGrade3() + getGrade4() + getGrade5())/5;
    }

       class studentAvg {
       public  void amethod (); 
            (double) studentAvg();
                  int which = (int)(Math.random() * 5);  //  Result is 1, 2, 3, 4, or 5.
                  default = (int) (Math.random();        // Result anything else
                       int studentAvg;
                       if  (studentAvg >= 95 && 
                               studentAvg <= 100 ); (whichGrade)=1;
                        }else; if(studentAvg>= 94 && 
                               studentAvg <90 ); (whichGrade)=2;
                        } else; if (studentAvg >=89 &&
                               studentAvg > 87); (whichGrade)=3;
                        }else; if (studentAvg >= 86 &&
                               studentAvg < 84); (whichGrade)=4:
                        }else; if (studentAvg >= 60); (whichGrade)=5;
                        switch (whichGrade);{

           if (which==1) 
     comment="You have a A";break;
        else; if (which==2) 
    comment="You have a A-.";break;
        else; if (which==3) 
    comment="You have a B.";break;
        else; if (which==4)   
    comment="You have a B-.";break;
       else; if (which==5)
    comment="You have an F."; break;
       else; if (default);
     default: comment="Something is wrong.";      

public class LearningJava {                               //Creates the Learning Java class
    public static void main(String[] args) {                  //Creates the main method

               Grades obj = new Grades();                //creates instance Grades* class
                obj.setGrade1(95.2);
                obj.setGrade2(93.5);
                obj.setGrade3(88.0);
                obj.setGrade4(84.5);
                obj.setGrade5(57.2);
                obj.displayAvg(); 
}     
}  
}            
}

I am getting illegal start of type or class, interface or enum expected in the switch

Edited 3 Years Ago by mike_2000_17: Fixed formatting

not going to read reams of unformatted code.
The error message tells you pretty much exactly what's the problem anyway, though sometimes it can be misleading and instead indicating at something wrong at an earlier stage like a bad or missing bracket.

Just at a glance there are numerous issues. You need to fix the obvious things then resubmit your code within code tags to allow for ease of reading.

This article has been dead for over six months. Start a new discussion instead.