[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

4.2

compile errors

Asked by Mrdogkick in Miscellaneous Programming, New to Java Programming

Tags: 143, jgrasp

Below is the code for a program which stores the names and marks of 30 students into an array. I am having problems with the displayResults method. Any suggestions?


    public class MScResults
   {
      public String namesIn;
      public int studentNoin;
      int totalNoOfStudents;
   
      private static final int NOOFSTUDENTS = 30;
      String[]names = new String[NOOFSTUDENTS];
      float [] marks= new float [NOOFSTUDENTS];
      int[] studentNo = new int [NOOFSTUDENTS];
       public MScResults()
      {
      }
       public int setNames(int studentNoin, String namesIn)
      {
         if(studentNoin >=1 &&studentNoin <= 30)
         {
            names[studentNoin-1] = namesIn;
            return 1;
         }
         else
         {
            return 0;
         }
      }
       public int storeMark(int studentNoin, float markObtained)
      {
         if(studentNoin >=1 &&studentNoin <= 30)
         {
            marks[studentNoin-1] = markObtained;
            return -1 ;
         }
         else
         {
            return -9;
         }
      }
       
   
       public int getNoOfStudents(float mark1, float mark2)
      {
         int totalStudents= 0;
     
     
         for(int i =0; i<=NOOFSTUDENTS; i++)
         {
            if(marks[i] <= mark1 && marks[i] >= mark2)
               return totalStudents= totalStudents +1;
            else if (marks[i] <= mark2 && marks[i] >= mark1)
               return totalStudents = totalStudents + 1;
         
         }
         return totalStudents;
      }
   
   
       public float getMark(int idNo)
      {
         if (idNo >=1 && idNo <=30)
         {
            return marks[idNo-1];
         }
         else
         {
            return -9;
         }
      }
   
   
   
   
          
          
          
          
       public void displayHighestMark()
      {
         int c=0;
         int highMarkIndex=0;
         float highestMark=0;
         while(c<30)
         {
            if (marks[c]> highestMark)
            {
               highestMark = marks[c];
               highMarkIndex=c;
            }
            c++;
         }
         System.out.println("Highest mark achieved is "+highestMark+" by "+names[highMarkIndex]);
      }
       public void displayLowestMark()
      {
         int c=0;
         int lowMarkIndex=0;
         float lowestMark=0;
         while (c<30)
         {
            if(marks[c]<lowestMark)
            {
               lowestMark = marks[c];
               lowMarkIndex=c;
            }
            c++;
         }
         System.out.println("Lowest mark achieved is "+lowestMark+" by "+names[lowMarkIndex]);
      }
   
   
       public float getAverageMark()
      {
         float average = 0;
         float sum = 0;
         for(int i=0; i<marks.length;i++)
         {
            sum = sum+marks[i];
            average = sum/30;
         }
         return average;
      }
         
         
       public void displayResults()
      {
         char grade= ' ';
         System.out.println("       MSc Results: School of MIS          ");
         System.out.println("Student Name\tPercentage Mark\tStatus/GRADE");
         System.out.println("-------------------------------------------");
     
         for(int i =0; i<=NOOFSTUDENTS; i++);
                  {
            System.out.println(" "+names+"\t"+marks+"\t" +grade);
         }
         if(marks[i]> 69.5)
         {
            System.out.println("you have obtained a distinction");
         }
         if(marks[i] >= 59.5 && marks[i]<=69.4)
         {
            System.out.println("you have obtained a merit");
         }
         if(marks[i] >=39.5 && marks[i] <=59.4)
         {
            System.out.println("you have obtained a pass");}
         else
         {
            if(marks[i] <39.5)
            {
               System.out.println(" you have failed");
            }
         }
      }
   
   }



and here are the errors....

   
     ----jGRASP exec: J:\jdk1.3\bin\javac H:\Java assignment\MScResults.java
   
    H:\Java assignment\MScResults.java:135: cannot resolve symbol
    symbol  : variable i  
    location: class MScResults
             if(marks[i]> 69.5)
                      ^
    H:\Java assignment\MScResults.java:139: cannot resolve symbol
    symbol  : variable i  
    location: class MScResults
             if(marks[i] >= 59.5 && marks[i]<=69.4)
                      ^
    H:\Java assignment\MScResults.java:139: cannot resolve symbol
    symbol  : variable i  
    location: class MScResults
             if(marks[i] >= 59.5 && marks[i]<=69.4)
                                          ^
    H:\Java assignment\MScResults.java:143: cannot resolve symbol
    symbol  : variable i  
    location: class MScResults
             if(marks[i] >=39.5 && marks[i] <=59.4)
                      ^
    H:\Java assignment\MScResults.java:143: cannot resolve symbol
    symbol  : variable i  
    location: class MScResults
             if(marks[i] >=39.5 && marks[i] <=59.4)
                                         ^
    H:\Java assignment\MScResults.java:148: cannot resolve symbol
    symbol  : variable i  
    location: class MScResults
                if(marks[i] <39.5)
                         ^
    6 errors
   

[+][-]05/05/04 03:27 AM, ID: 10994606Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 03:30 AM, ID: 10994622Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/05/04 03:37 AM, ID: 10994664Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 03:47 AM, ID: 10994693Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 03:55 AM, ID: 10994722Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/05/04 04:07 AM, ID: 10994762Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 04:21 AM, ID: 10994855Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/05/04 04:31 AM, ID: 10994909Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 04:37 AM, ID: 10994957Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/05/04 04:39 AM, ID: 10994970Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 04:48 AM, ID: 10995033Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 04:51 AM, ID: 10995052Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/05/04 04:55 AM, ID: 10995081Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 04:55 AM, ID: 10995082Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 04:57 AM, ID: 10995097Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/05/04 04:57 AM, ID: 10995100Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 04:59 AM, ID: 10995119Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 05:41 AM, ID: 10995435Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 05:47 AM, ID: 10995482Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 05:52 AM, ID: 10995516Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 05:54 AM, ID: 10995537Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 05:58 AM, ID: 10995558Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/05/04 06:08 AM, ID: 10995615Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 06:10 AM, ID: 10995635Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 06:15 AM, ID: 10995665Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/05/04 06:19 AM, ID: 10995697Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 06:25 AM, ID: 10995742Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/05/04 06:27 AM, ID: 10995751Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 06:27 AM, ID: 10995752Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 06:30 AM, ID: 10995776Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/05/04 06:33 AM, ID: 10995809Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 06:37 AM, ID: 10995847Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Miscellaneous Programming, New to Java Programming
Tags: 143, jgrasp
Sign Up Now!
Solution Provided By: ankuratvb
Participating Experts: 5
Solution Grade: A
 
[+][-]05/05/04 06:38 AM, ID: 10995859Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 06:41 AM, ID: 10995895Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 06:52 AM, ID: 10996021Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 07:07 AM, ID: 10996171Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 07:07 AM, ID: 10996173Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 07:19 AM, ID: 10996293Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 07:26 AM, ID: 10996354Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 07:57 AM, ID: 10996678Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 08:07 AM, ID: 10996783Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/05/04 08:09 AM, ID: 10996805Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/05/04 08:10 AM, ID: 10996808Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 08:15 AM, ID: 10996871Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 08:22 AM, ID: 10996949Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/05/04 08:33 AM, ID: 10997069Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/05/04 08:40 AM, ID: 10997135Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89