Results 1 to 3 of 3
  1. #1
    Starr29 is offline Member
    Join Date
    Jan 2009
    Posts
    26
    Rep Power
    0

    Default [SOLVED] Ready to Program Java IDE Problem #2

    Hello Everyone,

    Here is my assignment:
    Create a program that enters in 5 student names and their 4 subject marks. It should calculate the student's average. A value should then be entered between 1 and 5, and then the student with that index will have their report card printed with their name, 4 marks and average. Include a pass or fail message for each mark and the average.

    Here is what I have done so far:

    // The "Unit4Activity3Assignment2" class.
    import java.awt.*;
    import hsa.Console;

    public class Unit4Activity3Assignment2
    {
    static Console c; // The output console

    public static void main (String[] args)
    {
    c = new Console ();

    int number;
    double sum, average;
    sum = 0;

    String[] names = new String[5];
    double[] marks = new double[4];

    c.println ("5 student names and their 4 subject marks:");

    for(int i = 0; i < 5; i+=1)
    {
    c.println ();
    c.print ("Student Name: ");
    names[i] = c.readLine();
    c.println ();

    for(int j = 0; j < 4; j+=1)
    {
    c.print ("Subject Mark: ");
    marks[j] = c.readDouble();
    sum = sum + marks[j];
    }

    average = sum / 4;
    c.println ();
    c.println (names[i] + "'s Average: " + average);
    c.println ();
    sum = 0;
    }


    } // main method
    } // Unit4Activity3Assignment2 class

    Help on this "A value should then be entered between 1 and 5, and then the student with that index will have their report card printed with their name, 4 marks and average. Include a pass or fail message for each mark and the average." would be greatly appreciated.

    Thanks.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    What problem are you having specifically? It's hard to tell based on what you've typed.

    Good luck!

  3. #3
    Starr29 is offline Member
    Join Date
    Jan 2009
    Posts
    26
    Rep Power
    0

    Default

    I'm having problems with this: "A value should then be entered between 1 and 5, and then the student with that index will have their report card printed with their name, 4 marks and average. Include a pass or fail message for each mark and the average."

    Quote Originally Posted by Fubarable View Post
    What problem are you having specifically? It's hard to tell based on what you've typed.

    Good luck!

Similar Threads

  1. a problem about java mail client program
    By lunarstyle in forum AWT / Swing
    Replies: 9
    Last Post: 12-19-2009, 04:14 PM
  2. [SOLVED] Ready to Program Java IDE
    By Starr29 in forum New To Java
    Replies: 9
    Last Post: 07-24-2009, 05:21 PM
  3. Replies: 0
    Last Post: 04-04-2008, 02:40 PM
  4. Replies: 0
    Last Post: 10-04-2007, 09:33 PM
  5. getting problem in compiling java program?
    By sathish04021984 in forum New To Java
    Replies: 3
    Last Post: 07-30-2007, 09:26 AM

Posting Permissions

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