Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Page 3 of 5 FirstFirst 12345 LastLast
Results 51 to 75 of 110

Thread: Help me PLEASe! I need to submit by 8.30am tmr!

  1. #51
    Member
    Join Date
    Jul 2012
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Help me PLEASe! I need to submit by 8.30am tmr!

     
    S10122534c_Assignment.java:26: '.class' expected
    		finalMark = calculatefinalMark(int count,double[] caMark,double[] ctMark,double[] asgMark );
    		                                   ^
    S10122534c_Assignment.java:26: ';' expected
    		finalMark = calculatefinalMark(int count,double[] caMark,double[] ctMark,double[] asgMark );
    		                                        ^
    S10122534c_Assignment.java:26: <identifier> expected
    		finalMark = calculatefinalMark(int count,double[] caMark,double[] ctMark,double[] asgMark );
    		                                                         ^
    S10122534c_Assignment.java:26: <identifier> expected
    		finalMark = calculatefinalMark(int count,double[] caMark,double[] ctMark,double[] asgMark );
    		                                                                         ^
    S10122534c_Assignment.java:26: ';' expected
    		finalMark = calculatefinalMark(int count,double[] caMark,double[] ctMark,double[] asgMark );
    		                                                                                         ^
    S10122534c_Assignment.java:31: '.class' expected
    	  { case 1: displayStudentResults(String[] name, double[] caMark, double[] ctMark,double[] asgMark,double[] finalMark,int count);break;
    	                                           ^
    S10122534c_Assignment.java:31: ';' expected
    	  { case 1: displayStudentResults(String[] name, double[] caMark, double[] ctMark,double[] asgMark,double[] finalMark,int count);break;
    	                                               ^
    S10122534c_Assignment.java:31: <identifier> expected
    	  { case 1: displayStudentResults(String[] name, double[] caMark, double[] ctMark,double[] asgMark,double[] finalMark,int count);break;
    	                                                                 ^
    S10122534c_Assignment.java:31: <identifier> expected
    	  { case 1: displayStudentResults(String[] name, double[] caMark, double[] ctMark,double[] asgMark,double[] finalMark,int count);break;
    	                                                                                  ^
    S10122534c_Assignment.java:31: <identifier> expected
    	  { case 1: displayStudentResults(String[] name, double[] caMark, double[] ctMark,double[] asgMark,double[] finalMark,int count);break;
    	                                                                                                   ^
    S10122534c_Assignment.java:31: <identifier> expected
    	  { case 1: displayStudentResults(String[] name, double[] caMark, double[] ctMark,double[] asgMark,double[] finalMark,int count);break;
    	                                                                                                                      ^
    S10122534c_Assignment.java:31: ';' expected
    	  { case 1: displayStudentResults(String[] name, double[] caMark, double[] ctMark,double[] asgMark,double[] finalMark,int count);break;
    	                                                                                                                               ^
    S10122534c_Assignment.java:32: '.class' expected
           case 2: diplayFailedStudents(String[] name, double[] caMark, double[] ctMark,double[] asgMark,double[] finalMark,int count);break;
                                                 ^
    S10122534c_Assignment.java:32: ';' expected
           case 2: diplayFailedStudents(String[] name, double[] caMark, double[] ctMark,double[] asgMark,double[] finalMark,int count);break;
                                                     ^
    S10122534c_Assignment.java:32: <identifier> expected
           case 2: diplayFailedStudents(String[] name, double[] caMark, double[] ctMark,double[] asgMark,double[] finalMark,int count);break;
                                                                       ^
    S10122534c_Assignment.java:32: <identifier> expected
           case 2: diplayFailedStudents(String[] name, double[] caMark, double[] ctMark,double[] asgMark,double[] finalMark,int count);break;
                                                                                        ^
    S10122534c_Assignment.java:32: <identifier> expected
           case 2: diplayFailedStudents(String[] name, double[] caMark, double[] ctMark,double[] asgMark,double[] finalMark,int count);break;
                                                                                                         ^
    S10122534c_Assignment.java:32: <identifier> expected
           case 2: diplayFailedStudents(String[] name, double[] caMark, double[] ctMark,double[] asgMark,double[] finalMark,int count);break;
                                                                                                                            ^
    S10122534c_Assignment.java:32: ';' expected
           case 2: diplayFailedStudents(String[] name, double[] caMark, double[] ctMark,double[] asgMark,double[] finalMark,int count);break;
                                                                                                                                     ^
    S10122534c_Assignment.java:34: '.class' expected
    		 case 4: updateMarks(double asgMark,int count);break;
    		                            ^
    S10122534c_Assignment.java:34: ';' expected
    		 case 4: updateMarks(double asgMark,int count);break;
    		                                   ^
    S10122534c_Assignment.java:34: ';' expected
    		 case 4: updateMarks(double asgMark,int count);break;
    		                                             ^
    S10122534c_Assignment.java:35: not a statement
    		 case 5: exit[];break;
    		             ^
    23 errors

  2. #52
    Member
    Join Date
    Jul 2012
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Help me PLEASe! I need to submit by 8.30am tmr!

    i have edited.
     
    /*==================================================================================
     * FSP 2012 Assignment
     * Student ID	 : S10122534C  
     * Student Name : Leonard Laura Rachel M
     * Module Group :  FI05
     * 
     * ==================================================================================*/
     
    import java.util.Scanner;
     
    public class S10122534c_Assignment
    {
    	public static void main(String[] args)
    	{
    		final int MAXSIZE = 50; 						// maximum number of students	
    		String[] name   = new String[MAXSIZE];		// array to store the names of the students
    		double[] caMark = new double[MAXSIZE];		// array to store the Continuous Assessment marks
    		double[] ctMark = new double[MAXSIZE];		// array to store the Common Test marks
    		double[] asgMark = new double[MAXSIZE];	// array to store the Assignment marks
    		double[] finalMark = new double [MAXSIZE]; // array to store the Final marks
    		int count = 0;
    		Scanner input = new Scanner(System.in);
    		// initialize the array with students
    		count = initialization(name, caMark, ctMark, asgMark,finalMark);
    		int choice;
    		finalMark = calculatefinalMark(int count,double[] caMark,double[] ctMark,double[] asgMark );
    		do
    	  {	
    	  choice = input.nextInt();								
    	  switch (choice)
    	  { case 1: displayStudentResults(String[] name, double[] caMark, double[] ctMark,double[] asgMark,double[] finalMark,int count);break;
           case 2: diplayFailedStudents(String[] name, double[] caMark, double[] ctMark,double[] asgMark,double[] finalMark,int count);break;
    		 case 3: addNewStudent(count);break;
    		 case 4: updateMarks(double asgMark,int count);break;
    		 case 5: exit[];break;
    		 default:System.out.print("Thank you.");
    	   }
        }while (choice != 0);
     
    	 }
    	  // method to initialize the arrays with students
    	  public static int initialization(String[] name, double[] caMark, double[] ctMark, double[] asgMark, double[] finalMark)
    	 { 
    	   name [0] = "Agnes Tan";
    		caMark [0] = 75;
    		ctMark [0] = 68;
    		asgMark [0] = 82;
     
    		name [1] = "Benny Ong";
    		caMark [1] = 66;
    		ctMark [1] = 30;
    		asgMark [1] = 35;
     
    		name [2] = "Denise Ng";
    		caMark[2] = 55;
    		ctMark [2] = 42;
    		asgMark [2] = 50;
     
    		name [3] = "Jimmy Tay";
    		caMark [3] = 80;
    		ctMark [3] = 76;
    		asgMark[3] = 82;
     
    		name [4] = "Evelyn Low";
    		caMark [4] = 70;
    		ctMark [4] = 60;
    		asgMark [4] = 65;
     
    		return 5;	
     
    	  } 
    	  public static void displayMenue()
    	 {
    	  String[] nameArr; double[] caMarkArr; double[] ctMarkArr; double[] asgMarkArr; double[] finalMarkArr;
    	  {
    	  System.out.println ("MENU");
    	  System.out.println ("========================================");
    	  System.out.println (" [1]. Display the results of all students");
    	  System.out.println (" [2]. Display the students who have failed");
    	  System.out.println (" [3]. Add a new student");
    	  System.out.println (" [4]. Update assignment mark of a student");
    	  System.out.println (" [0]. Exit");
    	  System.out.println ("Enter your option: _____ ");
    	  System.out.println ("=========================================");
    	  } 	 
       }
       public static void displayStudentResults(String[] nameArr, double[] caMarkArr, double[] ctMarkArr, double[] asgMarkArr, double[] finalMarkArr)
    	{  int [] numArr = new int[50];
    	   System.out.println("Student Name" + "CA" + "CT" + "ASG" + "FINAL" + "GRADE"); 
    	   for (int i=0; i<numArr.length; i++)
    		{ System.out.println(nameArr[i] + caMarkArr[i] + ctMarkArr[i] + asgMarkArr[i] + finalMarkArr[i]);
    		  numArr[i]=i+1;
    		}
    	  }
    	  //Calculate Final marks to compute whether the student has passed & to know the grades
    	  public static double calculateFinalMarks(int count, double[] caMark, double[] ctMark, double[] asgMark) 
    	  {
    		int a = count;
    		finalMark = (0.4 * caMark[a]) + (0.3 * ctMark[a]) + (0.3 * asgMark[a]);
    		System.out.print(finalMark);
    		count++;
    		return finalMark;
    	}
    	   public static void displayFailedStudents (String[] name, double[] caMark, double[] ctMark, double[] asgMark, double[] finalMark) 
    	  { 
    	    System.out.println("No" + "Student Name" + "CA" + "CT" + "ASG" + "FINAL" + "GRADE");
    		 for (int l=0; l<count; l++)
    		 { 
    		   if (finalMark < 50)
    		     System.out.print(name[l], caMark[l], ctMark[l], asgMark[l], finalMark[l]);
    		 }
    	   }
    		public static void addNewStudent(int count)
    		{
    		  System.out.println("Option 3: Add New Student");
    		  System.out.println("Enter Student Name:  ");
    		  String name = input.next();
    		  System.out.println("Enter CA Marks:  ");
    		  double caMarks =  input.nextDouble();
    		  System.out.println("Enter CT Marks:   ");
    		  double ctMarks = input.nextDouble();
    		  System.out.println("Enter ASG Marks:  ");
    		  double asgMarks = input.nextDouble(); 
    		  System.out.println("One Student Added.");
    		  count++;
    		}
    		public static void updateMarks(int count, double asgMark)
    		{ int i = count;
    		  System.out.println("Option 4: Update Assignment Mark of a Student:   ");
    		  System.out.println("Enter the serial number of the student to update : ");
    		  i = input.nextInt();
            System.out.println("Enter new assignment mark : ");
    		  double asgMark = input.nextDouble();
            System.out.println("The assignment mark is updated. ");
    		  asgMark[count-1] = asgMarks;
    		}
          public static char gradeMark( double finalMark)
    		{ 
    			char gradeMark = 0;
    			if (finalMark >=80)
    			   System.out.println("Grade A");
    			if ((finalMark >=70) && (finalMark < 80))
    			   System.out.println("Grade B");
    			if ((finalMark >=60) && (finalMark < 70))
    			   System.out.println("Grade C");
    			if ((finalMark >= 50) && (finalMark < 60))
    			   System.out.println("Grade D");
    			if (finalMark < 50)
    			   System.out.println("Grade F");
     
    			  return gradeMark;
    		 }
    }

  3. #53
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Help me PLEASe! I need to submit by 8.30am tmr!

    On a side note.
    Always look at code with errorS, as being code with AN error.
    Look at the first error as if it were the only error.
    Fix that error, and then look at it again.

    First reason: When you fix one error, sometimes that clears up as many as ALL errors reported. Not always...

    Second reason: When you make changes here and there, and there and there and there, and take another look, you first of all could have made unnecessary changes and two if your changes leave errors, you will not know what change may have been in error and what changes were helpful, if any at all.

    Following this simple approach will ease the burden of debugging most of the time.

  4. #54
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Help me PLEASe! I need to submit by 8.30am tmr!

    Line#26 you have the same error you had before by adding the variable types in the method call.
    Remember when you DEFINE the method, you have to tell it what types the variables will be. But when you USE (call) the method, you DO NOT include the variable types.
    (remember when you removed the double[]s from the method call on your current line#24.)

    This error exists in your code as of post#52 multiple times. Many method calls you have included the variable types. Without scrolling I see this happen 4 times.

    Look over them method calls and be sure you are not trying to declare a type in a call. Be sure not to remove the types from the definitions!


    Edit: post your code again after you find and correct the errors of this type and include any questions you have (if any) about why this is the way it is.

  5. #55
    Member
    Join Date
    Jul 2012
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Help me PLEASe! I need to submit by 8.30am tmr!

    whats the problem wit this
    finalMark = calculatefinalMark( count, caMark, ctMark, asgMark );

  6. #56
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Help me PLEASe! I need to submit by 8.30am tmr!

    Quote Originally Posted by shadz92 View Post
    whats the problem wit this
    finalMark = calculatefinalMark( count, caMark, ctMark, asgMark );
    public static double calculateFinalMarks(int count, double[] caMark, double[] ctMark, double[] asgMark) 
    	  {
    		int a = count;
    		finalMark = (0.4 * caMark[a]) + (0.3 * ctMark[a]) + (0.3 * asgMark[a]);
    		System.out.print(finalMark);
    		count++;
    		return finalMark;
    	}
    Java is case and spelling sensetive....

  7. #57
    Member
    Join Date
    Jul 2012
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Help me PLEASe! I need to submit by 8.30am tmr!

    tis?
    [case=java]
    public static void displayFailedStudents (String[] name, double[] caMark, double[] ctMark, double[] asgMark, double[] finalMark)
    [/case]

  8. #58
    Member
    Join Date
    Jul 2012
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Help me PLEASe! I need to submit by 8.30am tmr!

    Sorry
    [case=java]
    public static void displayFailedStudents (String[] name, double[] caMark, double[] ctMark, double[] asgMark, double[] finalMark)
    [/case]

  9. #59
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Help me PLEASe! I need to submit by 8.30am tmr!

    Quote Originally Posted by shadz92 View Post
    tis?
    [case=java]
    public static void displayFailedStudents (String[] name, double[] caMark, double[] ctMark, double[] asgMark, double[] finalMark)
    [/case]
    I see nothing wrong with that line, other than convention says to place your opening brace on the same line, ie:
    public static void displayFailedStudents (String[] name, double[] caMark, double[] ctMark, double[] asgMark, double[] finalMark) {
    ...but since it is on the following line in your code, nothing wrong with that line as it stands.

  10. #60
    Member
    Join Date
    Jul 2012
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Help me PLEASe! I need to submit by 8.30am tmr!

    S10122534c_Assignment.java:105: class, interface, or enum expected
    public static void displayFailedStudents (String[] name, double[] caMark, double[] ctMark, double[] asgMark, double[] finalMark)
    ^
    S10122534c_Assignment.java:108: class, interface, or enum expected
    for (int l=0; l<count; l++)
    ^
    S10122534c_Assignment.java:108: class, interface, or enum expected
    for (int l=0; l<count; l++)
    ^
    S10122534c_Assignment.java:108: class, interface, or enum expected
    for (int l=0; l<count; l++)
    ^
    S10122534c_Assignment.java:112: class, interface, or enum expected
    }
    ^
    S10122534c_Assignment.java:114: class, interface, or enum expected
    public static void addNewStudent(int count)
    ^
    S10122534c_Assignment.java:117: class, interface, or enum expected
    System.out.println("Enter Student Name: ");
    ^
    S10122534c_Assignment.java:118: class, interface, or enum expected
    String name = input.next();
    ^
    S10122534c_Assignment.java:119: class, interface, or enum expected
    System.out.println("Enter CA Marks: ");
    ^
    S10122534c_Assignment.java:120: class, interface, or enum expected
    double caMarks = input.nextDouble();
    ^
    S10122534c_Assignment.java:121: class, interface, or enum expected
    System.out.println("Enter CT Marks: ");
    ^
    S10122534c_Assignment.java:122: class, interface, or enum expected
    double ctMarks = input.nextDouble();
    ^
    S10122534c_Assignment.java:123: class, interface, or enum expected
    System.out.println("Enter ASG Marks: ");
    ^
    S10122534c_Assignment.java:124: class, interface, or enum expected
    double asgMarks = input.nextDouble();
    ^
    S10122534c_Assignment.java:125: class, interface, or enum expected
    System.out.println("One Student Added.");
    ^
    S10122534c_Assignment.java:126: class, interface, or enum expected
    count++;
    ^
    S10122534c_Assignment.java:127: class, interface, or enum expected
    }
    ^
    S10122534c_Assignment.java:128: class, interface, or enum expected
    public static void updateMarks(int count, double asgMark)
    ^
    S10122534c_Assignment.java:130: class, interface, or enum expected
    System.out.println("Option 4: Update Assignment Mark of a Student: ");
    ^
    S10122534c_Assignment.java:131: class, interface, or enum expected
    System.out.println("Enter the serial number of the student to update : ");
    ^
    S10122534c_Assignment.java:132: class, interface, or enum expected
    i = input.nextInt();
    ^
    S10122534c_Assignment.java:133: class, interface, or enum expected
    System.out.println("Enter new assignment mark : ");
    ^
    S10122534c_Assignment.java:134: class, interface, or enum expected
    double asgMark = input.nextDouble();
    ^
    S10122534c_Assignment.java:135: class, interface, or enum expected
    System.out.println("The assignment mark is updated. ");
    ^
    S10122534c_Assignment.java:136: class, interface, or enum expected
    asgMark[count-1] = asgMarks;
    ^
    S10122534c_Assignment.java:137: class, interface, or enum expected
    }
    ^
    S10122534c_Assignment.java:138: class, interface, or enum expected
    public static char gradeMark( double finalMark)
    ^
    S10122534c_Assignment.java:141: class, interface, or enum expected
    if (finalMark >=80)
    ^
    S10122534c_Assignment.java:143: class, interface, or enum expected
    if ((finalMark >=70) && (finalMark < 80))
    ^
    S10122534c_Assignment.java:145: class, interface, or enum expected
    if ((finalMark >=60) && (finalMark < 70))
    ^
    S10122534c_Assignment.java:147: class, interface, or enum expected
    if ((finalMark >= 50) && (finalMark < 60))
    ^
    S10122534c_Assignment.java:149: class, interface, or enum expected
    if (finalMark < 50)
    ^
    S10122534c_Assignment.java:152: class, interface, or enum expected
    return gradeMark;
    ^
    S10122534c_Assignment.java:153: class, interface, or enum expected
    }
    ^
    34 errors

    ----jGRASP wedge2: exit code for process is 1.
    ----jGRASP: operation complete.



    This is the errors im getting!!

  11. #61
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Help me PLEASe! I need to submit by 8.30am tmr!

    refer to post #53.

    You are getting only one error.

    Post your code again as I currently have no idea what has been changed.

  12. #62
    Member
    Join Date
    Jul 2012
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Help me PLEASe! I need to submit by 8.30am tmr!

    ok here it is..
    S10122534c_Assignment.java:105: class, interface, or enum expected
    	   public static void displayFailedStudents (String[] name, double[] caMark, double[] ctMark, double[] asgMark, double[] finalMark) 
    	                 ^
    S10122534c_Assignment.java:108: class, interface, or enum expected
    		 for (int l=0; l<count; l++)
    		 ^
    S10122534c_Assignment.java:108: class, interface, or enum expected
    		 for (int l=0; l<count; l++)
    		               ^
    S10122534c_Assignment.java:108: class, interface, or enum expected
    		 for (int l=0; l<count; l++)
    		                        ^
    S10122534c_Assignment.java:112: class, interface, or enum expected
    		 }
    		 ^
    S10122534c_Assignment.java:114: class, interface, or enum expected
    		public static void addNewStudent(int count)
    		              ^
    S10122534c_Assignment.java:117: class, interface, or enum expected
    		  System.out.println("Enter Student Name:  ");
    		  ^
    S10122534c_Assignment.java:118: class, interface, or enum expected
    		  String name = input.next();
    		  ^
    S10122534c_Assignment.java:119: class, interface, or enum expected
    		  System.out.println("Enter CA Marks:  ");
    		  ^
    S10122534c_Assignment.java:120: class, interface, or enum expected
    		  double caMarks =  input.nextDouble();
    		  ^
    S10122534c_Assignment.java:121: class, interface, or enum expected
    		  System.out.println("Enter CT Marks:   ");
    		  ^
    S10122534c_Assignment.java:122: class, interface, or enum expected
    		  double ctMarks = input.nextDouble();
    		  ^
    S10122534c_Assignment.java:123: class, interface, or enum expected
    		  System.out.println("Enter ASG Marks:  ");
    		  ^
    S10122534c_Assignment.java:124: class, interface, or enum expected
    		  double asgMarks = input.nextDouble(); 
    		  ^
    S10122534c_Assignment.java:125: class, interface, or enum expected
    		  System.out.println("One Student Added.");
    		  ^
    S10122534c_Assignment.java:126: class, interface, or enum expected
    		  count++;
    		  ^
    S10122534c_Assignment.java:127: class, interface, or enum expected
    		}
    		^
    S10122534c_Assignment.java:128: class, interface, or enum expected
    		public static void updateMarks(int count, double asgMark)
    		              ^
    S10122534c_Assignment.java:130: class, interface, or enum expected
    		  System.out.println("Option 4: Update Assignment Mark of a Student:   ");
    		  ^
    S10122534c_Assignment.java:131: class, interface, or enum expected
    		  System.out.println("Enter the serial number of the student to update : ");
    		  ^
    S10122534c_Assignment.java:132: class, interface, or enum expected
    		  i = input.nextInt();
    		  ^
    S10122534c_Assignment.java:133: class, interface, or enum expected
            System.out.println("Enter new assignment mark : ");
            ^
    S10122534c_Assignment.java:134: class, interface, or enum expected
    		  double asgMark = input.nextDouble();
    		  ^
    S10122534c_Assignment.java:135: class, interface, or enum expected
            System.out.println("The assignment mark is updated. ");
            ^
    S10122534c_Assignment.java:136: class, interface, or enum expected
    		  asgMark[count-1] = asgMarks;
    		  ^
    S10122534c_Assignment.java:137: class, interface, or enum expected
    		}
    		^
    S10122534c_Assignment.java:138: class, interface, or enum expected
          public static char gradeMark( double finalMark)
                        ^
    S10122534c_Assignment.java:141: class, interface, or enum expected
    			if (finalMark >=80)
    			^
    S10122534c_Assignment.java:143: class, interface, or enum expected
    			if ((finalMark >=70) && (finalMark < 80))
    			^
    S10122534c_Assignment.java:145: class, interface, or enum expected
    			if ((finalMark >=60) && (finalMark < 70))
    			^
    S10122534c_Assignment.java:147: class, interface, or enum expected
    			if ((finalMark >= 50) && (finalMark < 60))
    			^
    S10122534c_Assignment.java:149: class, interface, or enum expected
    			if (finalMark < 50)
    			^
    S10122534c_Assignment.java:152: class, interface, or enum expected
    			  return gradeMark;
    			  ^
    S10122534c_Assignment.java:153: class, interface, or enum expected
    		 }
    		 ^
    34 errors
     
     ----jGRASP wedge2: exit code for process is 1.
     ----jGRASP: operation complete.

  13. #63
    Member
    Join Date
    Jul 2012
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Help me PLEASe! I need to submit by 8.30am tmr!

     
    import java.util.Scanner;
     
    public class S10122534c_Assignment
    {
    	public static void main(String[] args)
    	{
    		final int MAXSIZE = 50; 						// maximum number of students	
    		String[] name   = new String[MAXSIZE];		// array to store the names of the students
    		double[] caMark = new double[MAXSIZE];		// array to store the Continuous Assessment marks
    		double[] ctMark = new double[MAXSIZE];		// array to store the Common Test marks
    		double[] asgMark = new double[MAXSIZE];	// array to store the Assignment marks
    		double[] finalMark = new double [MAXSIZE]; // array to store the Final marks
    		int count = 0;
    		Scanner input = new Scanner(System.in);
    		// initialize the array with students
    		count = initialization(name, caMark, ctMark, asgMark,finalMark);
    		int choice;
    		finalMark = calculatefinalMark( count, caMark, ctMark, asgMark );
    		do
    	  {	
    	  choice = input.nextInt();								
    	  switch (choice)
    	  { case 1: displayStudentResults( name,  caMark,  ctMark, asgMark, finalMark, count);break;
           case 2: diplayFailedStudents( name,  caMark, ctMark, asgMark, finalMark, count);break;
    		 case 3: addNewStudent(count);break;
    		 case 4: updateMarks( asgMark, count);break;
    		 case 5: exit();break;
    		 default:System.out.print("Thank you.");
    	   }
        }while (choice != 0);
     
    	 }
    	  // method to initialize the arrays with students
    	  public static int initialization(String[] name, double[] caMark, double[] ctMark, double[] asgMark, double[] finalMark)
    	 { 
    	   name [0] = "Agnes Tan";
    		caMark [0] = 75;
    		ctMark [0] = 68;
    		asgMark [0] = 82;
     
    		name [1] = "Benny Ong";
    		caMark [1] = 66;
    		ctMark [1] = 30;
    		asgMark [1] = 35;
     
    		name [2] = "Denise Ng";
    		caMark[2] = 55;
    		ctMark [2] = 42;
    		asgMark [2] = 50;
     
    		name [3] = "Jimmy Tay";
    		caMark [3] = 80;
    		ctMark [3] = 76;
    		asgMark[3] = 82;
     
    		name [4] = "Evelyn Low";
    		caMark [4] = 70;
    		ctMark [4] = 60;
    		asgMark [4] = 65;
     
    		return 5;	
     
    	  } 
    	  public static void displayMenue()
    	 {
    	  String[] nameArr; double[] caMarkArr; double[] ctMarkArr; double[] asgMarkArr; double[] finalMarkArr;
    	  {
    	  System.out.println ("MENU");
    	  System.out.println ("========================================");
    	  System.out.println (" [1]. Display the results of all students");
    	  System.out.println (" [2]. Display the students who have failed");
    	  System.out.println (" [3]. Add a new student");
    	  System.out.println (" [4]. Update assignment mark of a student");
    	  System.out.println (" [0]. Exit");
    	  System.out.println ("Enter your option: _____ ");
    	  System.out.println ("=========================================");
    	  } 	 
       }
       public static void displayStudentResults(String[] nameArr, double[] caMarkArr, double[] ctMarkArr, double[] asgMarkArr, double[] finalMarkArr)
    	{  int [] numArr = new int[50];
    	   System.out.println("Student Name" + "CA" + "CT" + "ASG" + "FINAL" + "GRADE"); 
    	   for (int i=0; i<numArr.length; i++)
    		{ System.out.println(nameArr[i] + caMarkArr[i] + ctMarkArr[i] + asgMarkArr[i] + finalMarkArr[i]);
    		  numArr[i]=i+1;
    		}
    	  }
    	  //Calculate Final marks to compute whether the student has passed & to know the grades
    	  public static double calculateFinalMarks(int count, double[] caMark, double[] ctMark, double[] asgMark) 
    	  {
    		int a = count;
    		finalMark = (0.4 * caMark[a]) + (0.3 * ctMark[a]) + (0.3 * asgMark[a]);
    		System.out.print(finalMark);
    		count++;
    		return finalMark;
    	}
    	  	}
    	   public static void displayFailedStudents (String[] name, double[] caMark, double[] ctMark, double[] asgMark, double[] finalMark) 
    	  { 
    	    System.out.println("No" + "Student Name" + "CA" + "CT" + "ASG" + "FINAL" + "GRADE");
    		 for (int l=0; l<count; l++)
    		 { 
    		   if (finalMark < 50)
    		     System.out.print(name[l], caMark[l], ctMark[l], asgMark[l], finalMark[l]);
    		 }
    	   }
    		public static void addNewStudent(int count)
    		{
    		  System.out.println("Option 3: Add New Student");
    		  System.out.println("Enter Student Name:  ");
    		  String name = input.next();
    		  System.out.println("Enter CA Marks:  ");
    		  double caMarks =  input.nextDouble();
    		  System.out.println("Enter CT Marks:   ");
    		  double ctMarks = input.nextDouble();
    		  System.out.println("Enter ASG Marks:  ");
    		  double asgMarks = input.nextDouble(); 
    		  System.out.println("One Student Added.");
    		  count++;
    		}
    		public static void updateMarks(int count, double asgMark)
    		{ int i = count;
    		  System.out.println("Option 4: Update Assignment Mark of a Student:   ");
    		  System.out.println("Enter the serial number of the student to update : ");
    		  i = input.nextInt();
            System.out.println("Enter new assignment mark : ");
    		  double asgMark = input.nextDouble();
            System.out.println("The assignment mark is updated. ");
    		  asgMark[count-1] = asgMarks;
    		}
          public static char gradeMark( double finalMark)
    		{ 
    			char gradeMark = 0;
    			if (finalMark >=80)
    			   System.out.println("Grade A");
    			if ((finalMark >=70) && (finalMark < 80))
    			   System.out.println("Grade B");
    			if ((finalMark >=60) && (finalMark < 70))
    			   System.out.println("Grade C");
    			if ((finalMark >= 50) && (finalMark < 60))
    			   System.out.println("Grade D");
    			if (finalMark < 50)
    			   System.out.println("Grade F");
     
    			  return gradeMark;
    		 }
    }

  14. #64
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Help me PLEASe! I need to submit by 8.30am tmr!

    as of your code posted in post#63:

    Line#19: A method call as:
    finalMark = calculatefinalMark( count, caMark, ctMark, asgMark );
    compare to line#89:
    public static double calculateFinalMarks(int count, double[] caMark, double[] ctMark, double[] asgMark)
    and the related error message states:
    The method calculatefinalMark(int, double[], double[], double[]) is undefined for the type S10122534c_Assignment
    This error message means the compiler can not find a method with that signature. Where signature means the method name, return type, and listed parameters. Compare what you defined that method to be on line#89 and compare it to how you tried to use the method on line#19. Java is CASE and SPELLING sensetive.
    (there are two errors on line#19)
    Try to correct this, and ONLY this. Post the code again.

  15. #65
    Member
    Join Date
    Jul 2012
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Help me PLEASe! I need to submit by 8.30am tmr!

     
    import java.util.Scanner;
     
    public class S10122534c_Assignment
    {
    	public static void main(String[] args)
    	{
    		final int MAXSIZE = 50; 						// maximum number of students	
    		String[] name   = new String[MAXSIZE];		// array to store the names of the students
    		double[] caMark = new double[MAXSIZE];		// array to store the Continuous Assessment marks
    		double[] ctMark = new double[MAXSIZE];		// array to store the Common Test marks
    		double[] asgMark = new double[MAXSIZE];	// array to store the Assignment marks
    		double[] finalMark = new double [MAXSIZE]; // array to store the Final marks
    		int count = 0;
    		Scanner input = new Scanner(System.in);
    		// initialize the array with students
    		count = initialization(name, caMark, ctMark, asgMark,finalMark);
    		int choice;
    		FinalMark = calculateFinalMark( count, caMark, ctMark, asgMark );
    		do
    	  {	
    	  choice = input.nextInt();								
    	  switch (choice)
    	  { case 1: displayStudentResults( name,  caMark,  ctMark, asgMark, finalMark, count);break;
           case 2: diplayFailedStudents( name,  caMark, ctMark, asgMark, finalMark, count);break;
    		 case 3: addNewStudent(count);break;
    		 case 4: updateMarks( asgMark, count);break;
    		 case 5: exit();break;
    		 default:System.out.print("Thank you.");
    	   }
        }while (choice != 0);
     
    	 }
    	  // method to initialize the arrays with students
    	  public static int initialization(String[] name, double[] caMark, double[] ctMark, double[] asgMark, double[] finalMark)
    	 { 
    	   name [0] = "Agnes Tan";
    		caMark [0] = 75;
    		ctMark [0] = 68;
    		asgMark [0] = 82;
     
    		name [1] = "Benny Ong";
    		caMark [1] = 66;
    		ctMark [1] = 30;
    		asgMark [1] = 35;
     
    		name [2] = "Denise Ng";
    		caMark[2] = 55;
    		ctMark [2] = 42;
    		asgMark [2] = 50;
     
    		name [3] = "Jimmy Tay";
    		caMark [3] = 80;
    		ctMark [3] = 76;
    		asgMark[3] = 82;
     
    		name [4] = "Evelyn Low";
    		caMark [4] = 70;
    		ctMark [4] = 60;
    		asgMark [4] = 65;
     
    		return 5;	
     
    	  } 
    	  public static void displayMenue()
    	 {
    	  String[] nameArr; double[] caMarkArr; double[] ctMarkArr; double[] asgMarkArr; double[] finalMarkArr;
    	  {
    	  System.out.println ("MENU");
    	  System.out.println ("========================================");
    	  System.out.println (" [1]. Display the results of all students");
    	  System.out.println (" [2]. Display the students who have failed");
    	  System.out.println (" [3]. Add a new student");
    	  System.out.println (" [4]. Update assignment mark of a student");
    	  System.out.println (" [0]. Exit");
    	  System.out.println ("Enter your option: _____ ");
    	  System.out.println ("=========================================");
    	  } 	 
       }
       public static void displayStudentResults(String[] nameArr, double[] caMarkArr, double[] ctMarkArr, double[] asgMarkArr, double[] finalMarkArr)
    	{  int [] numArr = new int[50];
    	   System.out.println("Student Name" + "CA" + "CT" + "ASG" + "FINAL" + "GRADE"); 
    	   for (int i=0; i<numArr.length; i++)
    		{ System.out.println(nameArr[i] + caMarkArr[i] + ctMarkArr[i] + asgMarkArr[i] + finalMarkArr[i]);
    		  numArr[i]=i+1;
    		}
    	  }
    	  //Calculate Final marks to compute whether the student has passed & to know the grades
    	  public static double calculateFinalMarks(int count, double[] caMark, double[] ctMark, double[] asgMark) 
    	  {
    		int a = count;
    		finalMark = (0.4 * caMark[a]) + (0.3 * ctMark[a]) + (0.3 * asgMark[a]);
    		System.out.print(finalMark);
    		count++;
    		return finalMark;
    	}
    	  	}
    	   public static void displayFailedStudents (String[] name, double[] caMark, double[] ctMark, double[] asgMark, double[] FinalMark) 
    	  { 
    	    System.out.println("No" + "Student Name" + "CA" + "CT" + "ASG" + "FINAL" + "GRADE");
    		 for (int l=0; l<count; l++)
    		 { 
    		   if (finalMark < 50)
    		     System.out.print(name[l], caMark[l], ctMark[l], asgMark[l], finalMark[l]);
    		 }
    	   }
    		public static void addNewStudent(int count)
    		{
    		  System.out.println("Option 3: Add New Student");
    		  System.out.println("Enter Student Name:  ");
    		  String name = input.next();
    		  System.out.println("Enter CA Marks:  ");
    		  double caMarks =  input.nextDouble();
    		  System.out.println("Enter CT Marks:   ");
    		  double ctMarks = input.nextDouble();
    		  System.out.println("Enter ASG Marks:  ");
    		  double asgMarks = input.nextDouble(); 
    		  System.out.println("One Student Added.");
    		  count++;
    		}
    		public static void updateMarks(int count, double asgMark)
    		{ int i = count;
    		  System.out.println("Option 4: Update Assignment Mark of a Student:   ");
    		  System.out.println("Enter the serial number of the student to update : ");
    		  i = input.nextInt();
            System.out.println("Enter new assignment mark : ");
    		  double asgMark = input.nextDouble();
            System.out.println("The assignment mark is updated. ");
    		  asgMark[count-1] = asgMarks;
    		}
          public static char gradeMark( double finalMark)
    		{ 
    			char gradeMark = 0;
    			if (finalMark >=80)
    			   System.out.println("Grade A");
    			if ((finalMark >=70) && (finalMark < 80))
    			   System.out.println("Grade B");
    			if ((finalMark >=60) && (finalMark < 70))
    			   System.out.println("Grade C");
    			if ((finalMark >= 50) && (finalMark < 60))
    			   System.out.println("Grade D");
    			if (finalMark < 50)
    			   System.out.println("Grade F");
     
    			  return gradeMark;
    		 }
    }

  16. #66
    Member
    Join Date
    Jul 2012
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Help me PLEASe! I need to submit by 8.30am tmr!

    S10122534c_Assignment.java:105: class, interface, or enum expected
    public static void displayFailedStudents (String[] name, double[] caMark, double[] ctMark, double[] asgMark, double[] FinalMark)
    ^
    S10122534c_Assignment.java:108: class, interface, or enum expected
    for (int l=0; l<count; l++)
    ^
    S10122534c_Assignment.java:108: class, interface, or enum expected
    for (int l=0; l<count; l++)
    ^
    S10122534c_Assignment.java:108: class, interface, or enum expected
    for (int l=0; l<count; l++)
    ^
    S10122534c_Assignment.java:112: class, interface, or enum expected
    }
    ^
    S10122534c_Assignment.java:114: class, interface, or enum expected
    public static void addNewStudent(int count)
    ^
    S10122534c_Assignment.java:117: class, interface, or enum expected
    System.out.println("Enter Student Name: ");
    ^
    S10122534c_Assignment.java:118: class, interface, or enum expected
    String name = input.next();
    ^
    S10122534c_Assignment.java:119: class, interface, or enum expected
    System.out.println("Enter CA Marks: ");
    ^
    S10122534c_Assignment.java:120: class, interface, or enum expected
    double caMarks = input.nextDouble();
    ^
    S10122534c_Assignment.java:121: class, interface, or enum expected
    System.out.println("Enter CT Marks: ");
    ^
    S10122534c_Assignment.java:122: class, interface, or enum expected
    double ctMarks = input.nextDouble();
    ^
    S10122534c_Assignment.java:123: class, interface, or enum expected
    System.out.println("Enter ASG Marks: ");
    ^
    S10122534c_Assignment.java:124: class, interface, or enum expected
    double asgMarks = input.nextDouble();
    ^
    S10122534c_Assignment.java:125: class, interface, or enum expected
    System.out.println("One Student Added.");
    ^
    S10122534c_Assignment.java:126: class, interface, or enum expected
    count++;
    ^
    S10122534c_Assignment.java:127: class, interface, or enum expected
    }
    ^
    S10122534c_Assignment.java:128: class, interface, or enum expected
    public static void updateMarks(int count, double asgMark)
    ^
    S10122534c_Assignment.java:130: class, interface, or enum expected
    System.out.println("Option 4: Update Assignment Mark of a Student: ");
    ^
    S10122534c_Assignment.java:131: class, interface, or enum expected
    System.out.println("Enter the serial number of the student to update : ");
    ^
    S10122534c_Assignment.java:132: class, interface, or enum expected
    i = input.nextInt();
    ^
    S10122534c_Assignment.java:133: class, interface, or enum expected
    System.out.println("Enter new assignment mark : ");
    ^
    S10122534c_Assignment.java:134: class, interface, or enum expected
    double asgMark = input.nextDouble();
    ^
    S10122534c_Assignment.java:135: class, interface, or enum expected
    System.out.println("The assignment mark is updated. ");
    ^
    S10122534c_Assignment.java:136: class, interface, or enum expected
    asgMark[count-1] = asgMarks;
    ^
    S10122534c_Assignment.java:137: class, interface, or enum expected
    }
    ^
    S10122534c_Assignment.java:138: class, interface, or enum expected
    public static char gradeMark( double finalMark)
    ^
    S10122534c_Assignment.java:141: class, interface, or enum expected
    if (finalMark >=80)
    ^
    S10122534c_Assignment.java:143: class, interface, or enum expected
    if ((finalMark >=70) && (finalMark < 80))
    ^
    S10122534c_Assignment.java:145: class, interface, or enum expected
    if ((finalMark >=60) && (finalMark < 70))
    ^
    S10122534c_Assignment.java:147: class, interface, or enum expected
    if ((finalMark >= 50) && (finalMark < 60))
    ^
    S10122534c_Assignment.java:149: class, interface, or enum expected
    if (finalMark < 50)
    ^
    S10122534c_Assignment.java:152: class, interface, or enum expected
    return gradeMark;
    ^
    S10122534c_Assignment.java:153: class, interface, or enum expected
    }
    ^
    34 errors

    ----jGRASP wedge2: exit code for process is 1.
    ----jGRASP: operation complete.

  17. #67
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Help me PLEASe! I need to submit by 8.30am tmr!

    as of your code posted in post#65:

    line#18:
    FinalMark = calculateFinalMark( count, caMark, ctMark, asgMark );
    Again two errors, again java is case and spelling sensetive.

    First error:FinalMark cannot be resolved to a variable
    This means the compiler can not find a variable with the name "FinalMark".

    Second error:The method calculateFinalMark(int, double[], double[], double[]) is undefined for the type S10122534c_Assignment
    This means the compiler can not find a method with the signature: calculateFinalMark(int, double[], double[], double[]). As if your method does not exist at all!
    Well it in fact does NOT exist in your code. You have a method very close to it, but the spelling is different. You have to make sure to type the names exactly the same. If a letter is upper case in the definition, it must be upper case in the use. If the letter 's' is at the end of the name in the definition, it must be there in its use. This rule applies to variables and methods throughout java. Typos of this nature make it seem you have bigger problems than you do.

  18. #68
    Member
    Join Date
    Jul 2012
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Help me PLEASe! I need to submit by 8.30am tmr!

    now all are finalMark
     
    import java.util.Scanner;
     
    public class S10122534c_Assignment
    {
    	public static void main(String[] args)
    	{
    		final int MAXSIZE = 50; 						// maximum number of students	
    		String[] name   = new String[MAXSIZE];		// array to store the names of the students
    		double[] caMark = new double[MAXSIZE];		// array to store the Continuous Assessment marks
    		double[] ctMark = new double[MAXSIZE];		// array to store the Common Test marks
    		double[] asgMark = new double[MAXSIZE];	// array to store the Assignment marks
    		double[] finalMark = new double [MAXSIZE]; // array to store the Final marks
    		int count = 0;
    		Scanner input = new Scanner(System.in);
    		// initialize the array with students
    		count = initialization(name, caMark, ctMark, asgMark,finalMark);
    		int choice;
    		finalMark = calculatefinalMark( count, caMark, ctMark, asgMark );
    		do
    	  {	
    	  choice = input.nextInt();								
    	  switch (choice)
    	  { case 1: displayStudentResults( name,  caMark,  ctMark, asgMark, finalMark, count);break;
           case 2: diplayFailedStudents( name,  caMark, ctMark, asgMark, finalMark, count);break;
    		 case 3: addNewStudent(count);break;
    		 case 4: updateMarks( asgMark, count);break;
    		 case 5: exit();break;
    		 default:System.out.print("Thank you.");
    	   }
        }while (choice != 0);
     
    	 }
    	  // method to initialize the arrays with students
    	  public static int initialization(String[] name, double[] caMark, double[] ctMark, double[] asgMark, double[] finalMark)
    	 { 
    	   name [0] = "Agnes Tan";
    		caMark [0] = 75;
    		ctMark [0] = 68;
    		asgMark [0] = 82;
     
    		name [1] = "Benny Ong";
    		caMark [1] = 66;
    		ctMark [1] = 30;
    		asgMark [1] = 35;
     
    		name [2] = "Denise Ng";
    		caMark[2] = 55;
    		ctMark [2] = 42;
    		asgMark [2] = 50;
     
    		name [3] = "Jimmy Tay";
    		caMark [3] = 80;
    		ctMark [3] = 76;
    		asgMark[3] = 82;
     
    		name [4] = "Evelyn Low";
    		caMark [4] = 70;
    		ctMark [4] = 60;
    		asgMark [4] = 65;
     
    		return 5;	
     
    	  } 
    	  public static void displayMenue()
    	 {
    	  String[] nameArr; double[] caMarkArr; double[] ctMarkArr; double[] asgMarkArr; double[] finalMarkArr;
    	  {
    	  System.out.println ("MENU");
    	  System.out.println ("========================================");
    	  System.out.println (" [1]. Display the results of all students");
    	  System.out.println (" [2]. Display the students who have failed");
    	  System.out.println (" [3]. Add a new student");
    	  System.out.println (" [4]. Update assignment mark of a student");
    	  System.out.println (" [0]. Exit");
    	  System.out.println ("Enter your option: _____ ");
    	  System.out.println ("=========================================");
    	  } 	 
       }
       public static void displayStudentResults(String[] nameArr, double[] caMarkArr, double[] ctMarkArr, double[] asgMarkArr, double[] finalMarkArr)
    	{  int [] numArr = new int[50];
    	   System.out.println("Student Name" + "CA" + "CT" + "ASG" + "FINAL" + "GRADE"); 
    	   for (int i=0; i<numArr.length; i++)
    		{ System.out.println(nameArr[i] + caMarkArr[i] + ctMarkArr[i] + asgMarkArr[i] + finalMarkArr[i]);
    		  numArr[i]=i+1;
    		}
    	  }
    	  //Calculate Final marks to compute whether the student has passed & to know the grades
    	  public static double calculateFinalMarks(int count, double[] caMark, double[] ctMark, double[] asgMark) 
    	  {
    		int a = count;
    		finalMark = (0.4 * caMark[a]) + (0.3 * ctMark[a]) + (0.3 * asgMark[a]);
    		System.out.print(finalMark);
    		count++;
    		return finalMark;
    	}
    	  	}
    	   public static void displayfailedStudents (String[] name, double[] caMark, double[] ctMark, double[] asgMark, double[] finalMark) 
    	  { 
    	    System.out.println("No" + "Student Name" + "CA" + "CT" + "ASG" + "FINAL" + "GRADE");
    		 for (int l=0; l<count; l++)
    		 { 
    		   if (finalMark < 50)
    		     System.out.print(name[l], caMark[l], ctMark[l], asgMark[l], finalMark[l]);
    		 }
    	   }
    		public static void addNewStudent(int count)
    		{
    		  System.out.println("Option 3: Add New Student");
    		  System.out.println("Enter Student Name:  ");
    		  String name = input.next();
    		  System.out.println("Enter CA Marks:  ");
    		  double caMarks =  input.nextDouble();
    		  System.out.println("Enter CT Marks:   ");
    		  double ctMarks = input.nextDouble();
    		  System.out.println("Enter ASG Marks:  ");
    		  double asgMarks = input.nextDouble(); 
    		  System.out.println("One Student Added.");
    		  count++;
    		}
    		public static void updateMarks(int count, double asgMark)
    		{ int i = count;
    		  System.out.println("Option 4: Update Assignment Mark of a Student:   ");
    		  System.out.println("Enter the serial number of the student to update : ");
    		  i = input.nextInt();
            System.out.println("Enter new assignment mark : ");
    		  double asgMark = input.nextDouble();
            System.out.println("The assignment mark is updated. ");
    		  asgMark[count-1] = asgMarks;
    		}
          public static char gradeMark( double finalMark)
    		{ 
    			char gradeMark = 0;
    			if (finalMark >=80)
    			   System.out.println("Grade A");
    			if ((finalMark >=70) && (finalMark < 80))
    			   System.out.println("Grade B");
    			if ((finalMark >=60) && (finalMark < 70))
    			   System.out.println("Grade C");
    			if ((finalMark >= 50) && (finalMark < 60))
    			   System.out.println("Grade D");
    			if (finalMark < 50)
    			   System.out.println("Grade F");
     
    			  return gradeMark;
    		 }
    }

  19. #69
    Member
    Join Date
    Jul 2012
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Help me PLEASe! I need to submit by 8.30am tmr!

    Dear friend could you like help me put the codes correctly..
    I have to submit them by 8.00

  20. #70
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Help me PLEASe! I need to submit by 8.30am tmr!

    class, interface, or enum expected
    This error message from the compiler means it has found the end of a class's definition and is looking for the next definition of either class, interface, or enum. Check for extra }s that could have ended a class definition before you intended.
    If you don't understand my answer, don't ignore it, ask a question.

  21. #71
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Help me PLEASe! I need to submit by 8.30am tmr!

    I want to point out that finalMark has nothing to do with calculateFinalMark.

    When you declared the variable finalMark, you declared it with a lower case 'f' on the front. Any time you use that variable, you must use it with a lower case 'f' on the front.

    When you declared(& defined) your method calculateFinalMarks (on line#88 as of your most recent post) you have a cap 'F' for the final and you have an 's' on the end.

    You have to look at the error message, and understand what it means. If you do not know what it means, that is a question you can post and someone will answer it. I get the feeling you are lost and just making changes you are told to make. Tell me what it is you don't understand about what is going on and I will try to help you understand.

  22. #72
    Member
    Join Date
    Jul 2012
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Help me PLEASe! I need to submit by 8.30am tmr!

    I dont get you friend!

  23. #73
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Help me PLEASe! I need to submit by 8.30am tmr!

    to be clear, when I said:
    Quote Originally Posted by jps View Post
    I want to point out that finalMark has nothing to do with calculateFinalMark...
    I meant that changing FinalMark = calculateFinalMark to finalMark = calculatefinalMark is not what the problem is.

  24. #74
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Help me PLEASe! I need to submit by 8.30am tmr!

    ok step back and just have a look at only two lines of code.
    So we are looking at the same thing look at the code you posted in post#68

    look at the method name you are using on line#18. Compare that to the method name you defined on line#88

    They are not the same name. Do you see the difference in the two?

  25. #75
    Member
    Join Date
    Jul 2012
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Help me PLEASe! I need to submit by 8.30am tmr!

     
    *==================================================================================
     * FSP 2012 Assignment
     * Student ID	 : S10122534C  
     * Student Name : Leonard Laura Rachel M
     * Module Group :  FI05
     * 
     * ==================================================================================*/
     
    import java.util.Scanner;
     
    public class S10122534c_Assignment
    {
    	public static void main(String[] args)
    	{
    		final int MAXSIZE = 50; 						// maximum number of students	
    		String[] name   = new String[MAXSIZE];		// array to store the names of the students
    		double[] caMark = new double[MAXSIZE];		// array to store the Continuous Assessment marks
    		double[] ctMark = new double[MAXSIZE];		// array to store the Common Test marks
    		double[] asgMark = new double[MAXSIZE];	// array to store the Assignment marks
    		double[] finalMark = new double [MAXSIZE]; // array to store the Final marks
    		int count = 0;
    		Scanner input = new Scanner(System.in);
    		// initialize the array with students
    		count = initialization(name, caMark, ctMark, asgMark,finalMark);
    		int choice;
    		finalMark = calculatefinalMark( count, caMark, ctMark, asgMark );
    		do
    	  {	
    	  choice = input.nextInt();								
    	  switch (choice)
    	  { case 1: displayStudentResults( name,  caMark,  ctMark, asgMark, finalMark, count);break;
           case 2: diplayFailedStudents( name,  caMark, ctMark, asgMark, finalMark, count);break;
    		 case 3: addNewStudent(count);break;
    		 case 4: updateMarks( asgMark, count);break;
    		 case 5: exit();break;
    		 default:System.out.print("Thank you.");
    	   }
        }while (choice != 0);
     
    	 }
    	  // method to initialize the arrays with students
    	  public static int initialization(String[] name, double[] caMark, double[] ctMark, double[] asgMark, double[] finalMark)
    	 { 
    	   name [0] = "Agnes Tan";
    		caMark [0] = 75;
    		ctMark [0] = 68;
    		asgMark [0] = 82;
     
    		name [1] = "Benny Ong";
    		caMark [1] = 66;
    		ctMark [1] = 30;
    		asgMark [1] = 35;
     
    		name [2] = "Denise Ng";
    		caMark[2] = 55;
    		ctMark [2] = 42;
    		asgMark [2] = 50;
     
    		name [3] = "Jimmy Tay";
    		caMark [3] = 80;
    		ctMark [3] = 76;
    		asgMark[3] = 82;
     
    		name [4] = "Evelyn Low";
    		caMark [4] = 70;
    		ctMark [4] = 60;
    		asgMark [4] = 65;
     
    		return 5;	
     
    	  } 
    	  public static void displayMenue()
    	 {
    	  String[] nameArr; double[] caMarkArr; double[] ctMarkArr; double[] asgMarkArr; double[] finalMarkArr;
    	  {
    	  System.out.println ("MENU");
    	  System.out.println ("========================================");
    	  System.out.println (" [1]. Display the results of all students");
    	  System.out.println (" [2]. Display the students who have failed");
    	  System.out.println (" [3]. Add a new student");
    	  System.out.println (" [4]. Update assignment mark of a student");
    	  System.out.println (" [0]. Exit");
    	  System.out.println ("Enter your option: _____ ");
    	  System.out.println ("=========================================");
    	  } 	 
       }
       public static void displayStudentResults(String[] nameArr, double[] caMarkArr, double[] ctMarkArr, double[] asgMarkArr, double[] finalMarkArr)
    	{  int [] numArr = new int[50];
    	   System.out.println("Student Name" + "CA" + "CT" + "ASG" + "FINAL" + "GRADE"); 
    	   for (int i=0; i<numArr.length; i++)
    		{ System.out.println(nameArr[i] + caMarkArr[i] + ctMarkArr[i] + asgMarkArr[i] + finalMarkArr[i]);
    		  numArr[i]=i+1;
    		}
    	  }
    	  //Calculate Final marks to compute whether the student has passed & to know the grades
    	  public static double calculatefinalMark(int count, double[] caMark, double[] ctMark, double[] asgMark) 
    	  {
    		int a = count;
    		finalMark = (0.4 * caMark[a]) + (0.3 * ctMark[a]) + (0.3 * asgMark[a]);
    		System.out.print(finalMark);
    		count++;
    		return finalMark;
    	}
    	  	}
    	   public static void displayfailedStudents (String[] name, double[] caMark, double[] ctMark, double[] asgMark, double[] finalMark) 
    	  { 
    	    System.out.println("No" + "Student Name" + "CA" + "CT" + "ASG" + "FINAL" + "GRADE");
    		 for (int l=0; l<count; l++)
    		 { 
    		   if (finalMark < 50)
    		     System.out.print(name[l], caMark[l], ctMark[l], asgMark[l], finalMark[l]);
    		 }
    	   }
    		public static void addNewStudent(int count)
    		{
    		  System.out.println("Option 3: Add New Student");
    		  System.out.println("Enter Student Name:  ");
    		  String name = input.next();
    		  System.out.println("Enter CA Marks:  ");
    		  double caMarks =  input.nextDouble();
    		  System.out.println("Enter CT Marks:   ");
    		  double ctMarks = input.nextDouble();
    		  System.out.println("Enter ASG Marks:  ");
    		  double asgMarks = input.nextDouble(); 
    		  System.out.println("One Student Added.");
    		  count++;
    		}
    		public static void updateMarks(int count, double asgMark)
    		{ int i = count;
    		  System.out.println("Option 4: Update Assignment Mark of a Student:   ");
    		  System.out.println("Enter the serial number of the student to update : ");
    		  i = input.nextInt();
            System.out.println("Enter new assignment mark : ");
    		  double asgMark = input.nextDouble();
            System.out.println("The assignment mark is updated. ");
    		  asgMark[count-1] = asgMarks;
    		}
          public static char gradeMark( double finalMark)
    		{ 
    			char gradeMark = 0;
    			if (finalMark >=80)
    			   System.out.println("Grade A");
    			if ((finalMark >=70) && (finalMark < 80))
    			   System.out.println("Grade B");
    			if ((finalMark >=60) && (finalMark < 70))
    			   System.out.println("Grade C");
    			if ((finalMark >= 50) && (finalMark < 60))
    			   System.out.println("Grade D");
    			if (finalMark < 50)
    			   System.out.println("Grade F");
     
    			  return gradeMark;
    		 }
    }

Page 3 of 5 FirstFirst 12345 LastLast

Similar Threads

  1. Replies: 1
    Last Post: January 31st, 2013, 04:55 AM
  2. Replies: 6
    Last Post: December 6th, 2011, 08:46 AM
  3. Notepad is opening on click of submit instead navigating to other page
    By pb60705 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 10th, 2011, 07:23 AM
  4. unable to go to next page...while clicking submit button
    By javaking in forum JavaServer Pages: JSP & JSTL
    Replies: 0
    Last Post: April 29th, 2010, 02:55 AM
  5. vending machine submit button help
    By maybach230 in forum Java Applets
    Replies: 3
    Last Post: April 23rd, 2010, 10:16 AM