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 1 of 5 123 ... LastLast
Results 1 to 25 of 110

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

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

    Default 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,int[] caMark,int[] ctMark,int[] asgMark);
    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, int[] caMark, int[] ctMark, int[] asgMark, int[] finalMark)
    {
    namer [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; int[] caMarkArr; int[] ctMarkArr; int[] asgMarkArr; int[] finalMarkArr;
    {
    System.out.println ("MENUE");
    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, int[] caMarkArr, int[] ctMarkArr, int[] asgMarkArr, int[] 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, int[] caMark, int[] ctMark, int[] asgMark, int[] 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;
    }
    }


  2. #2
    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!

    Please wrap code tags around your code.
    ...and, then feel free to tell the forum what the problem is, or what question you have, including all error messages you may be getting.

  3. #3
    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!

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

    S10122534c_Assignment.java:29: error: '.class' expected
    count = initialization( name, int[] caMark, int[] ctMark, int[] asgMark);
    ^
    S10122534c_Assignment.java:29: error: ';' expected
    count = initialization( name, int[] caMark, int[] ctMark, int[] asgMark);
    ^

    S10122534c_Assignment.java:29: error: <identifier> expected
    count = initialization( name, int[] caMark, int[] ctMark, int[] asgMark);
    ^
    S10122534c_Assignment.java:29: error: illegal start of expression
    count = initialization( name, int[] caMark, int[] ctMark, int[] asgMark);

    S10122534c_Assignment.java:29: error: not a statement
    count = initialization( name, int[] caMark, int[] ctMark, int[] asgMark);
    ^
    S10122534c_Assignment.java:29: error: ';' expected
    count = initialization( name, int[] caMark, int[] ctMark, int[] asgMark);
    ^

  4. #4
    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:29: error: '.class' expected
    ÏÏ§Ï count = initialization( name, int[] caMark, int[] ctMark, int[] asgMark);
    ÏÏ§Ï ^
    ϼ§ÏS10122534c_Assignment.java:29: error: ';' expected
    ÏÏ§Ï count = initialization( name, int[] caMark, int[] ctMark, int[] asgMark);
    ÏÏ§Ï ^
    ϼ§ÏS10122534c_Assignment.java:29: error: <identifier> expected
    ÏÏ§Ï count = initialization( name, int[] caMark, int[] ctMark, int[] asgMark);
    ÏÏ§Ï ^
    ϼ§ÏS10122534c_Assignment.java:29: error: illegal start of expression
    ÏÏ§Ï count = initialization( name, int[] caMark, int[] ctMark, int[] asgMark);
    ÏÏ§Ï ^
    ϼ§ÏS10122534c_Assignment.java:29: error: ';' expected
    ÏÏ§Ï count = initialization( name, int[] caMark, int[] ctMark, int[] asgMark);
    ÏÏ§Ï ^
    ϼ§ÏS10122534c_Assignment.java:29: error: not a statement
    ÏÏ§Ï count = initialization( name, int[] caMark, int[] ctMark, int[] asgMark);
    ÏÏ§Ï ^
    ϼ§ÏS10122534c_Assignment.java:29: error: ';' expected
    ÏÏ§Ï count = initialization( name, int[] caMark, int[] ctMark, int[] asgMark);
    ÏÏ§Ï ^
    ÏϧÏ7 errors

  5. #5
    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!

    well you got the last part of what i said. Try to attack the first one( please edit your post and wrap code tags around your code) and one of the inner two(tell what your problme is or ask a question)... although i *could* read all that code looking text and the error messages, I simply wont. :/ Sorry man/woman/child/other, make it easy for me(us) to help you and it will be a happy day for both(all) of us.

  6. #6
    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:29: error: '.class' expected
    count = initialization( name, int[] caMark, int[] ctMark, int[] asgMark);

    S10122534c_Assignment.java:29: error: ';' expected
    count = initialization( name, int[] caMark, int[] ctMark, int[] asgMark)

    S10122534c_Assignment.java:29: error: <identifier> expected
    count = initialization( name, int[] caMark, int[] ctMark, int[] asgMark);

    S10122534c_Assignment.java:29: error: illegal start of expression
    count = initialization( name, int[] caMark, int[] ctMark, int[] asgMark);

    S10122534c_Assignment.java:29: error: ';' expected
    count = initialization( name, int[] caMark, int[] ctMark, int[] asgMark);

    S10122534c_Assignment.java:29: error: not a statement
    count = initialization( name, int[] caMark, int[] ctMark, int[] asgMark);

    S10122534c_Assignment.java:29: error: ';' expected
    count = initialization( name, int[] caMark, int[] ctMark, int[] asgMark);

    7 errors

  7. #7
    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 to display the results of all students
    Display the students who have failed
    add a new student
    update assignment mark of a student
    exit

  8. #8
    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!

    this is the table

  9. #9
    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!

    Pasting your assignment instructions is a bit far off from a question. I still don't know how to help you, just how to write your program for you. Which is not going to happen. ...and to fix your first post, highlight all of your code and click the button to wrap code tags around selected text.

  10. #10
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

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

    Edit your first post and wrap your code with
    [code=java]
    <YOUR CODE HERE>
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

  11. The Following User Says Thank You to Norm For This Useful Post:

    jps (July 29th, 2012)

  12. #11
    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,int[] caMark,int[] ctMark,int[] asgMark); They say must '.class' expected and <identifier> epected
    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, int[] caMark, int[] ctMark, int[] asgMark, int[] finalMark)
    {
    namer [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; int[] caMarkArr; int[] ctMarkArr; int[] asgMarkArr; int[] finalMarkArr;
    {
    System.out.println ("MENUE");
    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, int[] caMarkArr, int[] ctMarkArr, int[] asgMarkArr, int[] 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, int[] caMark, int[] ctMark, int[] asgMark, int[] 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;
    }
    }

  13. #12
    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,int[] caMark,int[] ctMark,int[] asgMark);
    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, int[] caMark, int[] ctMark, int[] asgMark, int[] finalMark)
    { 
    namer [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; int[] caMarkArr; int[] ctMarkArr; int[] asgMarkArr; int[] finalMarkArr;
    {
    System.out.println ("MENUE");
    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, int[] caMarkArr, int[] ctMarkArr, int[] asgMarkArr, int[] 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, int[] caMark, int[] ctMark, int[] asgMark, int[] 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. #13
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

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

    Why is there no formatting/indentations in the code posted in post #12? All the statements start in column one. That makes it very hard to read and understand the logic of the program.
    Proper formatting is very important with the errors you are having which seem to be about misplaced statements.
    Can you post code that has proper indentation?

    A problem you are having is including the type of the arguments in the call to the initialization() method. You should only put the names of the variables in the argument list being passed to the method. The types of those args are defined in the method definition.
    Last edited by Norm; July 29th, 2012 at 12:48 PM.
    If you don't understand my answer, don't ignore it, ask a question.

  15. #14
    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,int[] caMark,int[] ctMark,int[] asgMark);
    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, int[] caMark, int[] ctMark, int[] asgMark, int[] finalMark)
    { 
    namer [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; int[] caMarkArr; int[] ctMarkArr; int[] asgMarkArr; int[] finalMarkArr;
    {
    System.out.println ("MENUE");
    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, int[] caMarkArr, int[] ctMarkArr, int[] asgMarkArr, int[] 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, int[] caMark, int[] ctMark, int[] asgMark, int[] 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. #15
    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!

    [codejava]
    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,int[] caMark,int[] ctMark,int[] asgMark);
    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, int[] caMark, int[] ctMark, int[] asgMark, int[] finalMark)
    {
    namer [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; int[] caMarkArr; int[] ctMarkArr; int[] asgMarkArr; int[] finalMarkArr;
    {
    System.out.println ("MENUE");
    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, int[] caMarkArr, int[] ctMarkArr, int[] asgMarkArr, int[] 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, int[] caMark, int[] ctMark, int[] asgMark, int[] 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;
    }
    }

    [/code]

  17. #16
    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,int[] caMark,int[] ctMark,int[] asgMark);
    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, int[] caMark, int[] ctMark, int[] asgMark, int[] finalMark)
    { 
    namer [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; int[] caMarkArr; int[] ctMarkArr; int[] asgMarkArr; int[] finalMarkArr;
    {
    System.out.println ("MENUE");
    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, int[] caMarkArr, int[] ctMarkArr, int[] asgMarkArr, int[] 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, int[] caMark, int[] ctMark, int[] asgMark, int[] 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;
    }
    }

  18. #17
    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 dun understand what you just said

  19. #18
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

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

    See post #13

    Try using the Go Advanced button(below) and the Preview Post button so you see what you are going to post
    instead of posting 2 and 3 times without proper formatting.
    If you don't understand my answer, don't ignore it, ask a question.

  20. #19
    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!

    public static int initialization(String[] name, double[] caMark, double[] ctMark, double[] asgMark)

    is it this line?
    What must it be?

  21. #20
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

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

    That looks like the definition for a method. Its syntax looks ok.
    Look at where that method is called (at the first error message)
    If you don't understand my answer, don't ignore it, ask a question.

  22. #21
    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!

    Well I can see you are trying, so while you work on that I will give your code a once over in an ide for speed.

    So I copy-pasted your code from post #16 into an ide. Here is what I see to start...

    line15: The method initialization(String[], int[], int[], int[], int[]) in the type S10122534c_Assignment is not applicable for the arguments (String[], double[], double[], double[])
    ...you are not sending the method what it expects to get.

    line17: The method calculateFinalMark(int, double[], double[], double[]) is undefined for the type S10122534c_Assignment
    ...you named the method calculateFinalMarks. Note that there is an 's' at the end where you defined the method, but no 's' at the end when you tried to use it. This specific mistake appears many times in your code. (Where a variable sometimes has an s on the end, and sometimes does not)

    line98: your code as follows:
    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;
    	}
    Notice that you immediately hide your parameter named count by immediately declaring another variable within the method named count.

    Take a good once over your code, and fix those bad variable names and see what you can come up with on the hidden parameter in your method posted above.
    Repost your code after you have done that and I will look at any remaining errors you have at that point.

  23. #22
    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!

     
    // initialize the array with students
    		count = initialization(name,int[] caMark,int[] ctMark,int[] asgMark);
    		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);
     
    	 }

    How do i go about to initialize the array with students

  24. #23
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

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

    Use a loop and add the new objects to the array at the index value.
    If you don't understand my answer, don't ignore it, ask a question.

  25. #24
    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!

    okkay i hav done the changes
    Can you look through if i have done the correct thing..
    /*==================================================================================
     * 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,double[] caMark,double[] ctMark,double[] asgMark);
    		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: updateMark(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)
    	 { 
    	   namer [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 displayMenu()
    	 {
    	  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 updateMark(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;
    		 }
    }

  26. #25
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

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

    if i have done the correct thing..
    The formatting is much better.

    Did you try to compile the program? What did the compiler say? Post the full text of the error messages.
    		count = initialization(name,double[] caMark,double[] ctMark,double[] asgMark);
    		int choice;
    		finalMark = calculateFinalMark(count,caMark, ctMark, asgMark);

    You call two methods here. The first one using bad syntax and the second one looks ok.
    Do you see the difference? You do NOT put the type of the argument in the argument list.
    Remove the double[]s
    Last edited by Norm; July 29th, 2012 at 01:45 PM.
    If you don't understand my answer, don't ignore it, ask a question.

Page 1 of 5 123 ... 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