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.


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

Results 1 to 3 of 3

Thread: Coding Problem

  1. #1
    Junior Member
    Join Date
    Feb 2012
    My Mood
    Thanked 0 Times in 0 Posts

    Default Coding Problem

    Hey all, I'm super new to programming, and have a project where I have to write a program that outputs the students names, along with two grades for each student, the average of those grades, then the average of the averages at the end. Finally, I have to have an output at the end that depends on what the total average was (if, then). The following is the code that I have so far, however I'm not supposed to "hard code" the grades as I've done, they're supposed to be entered as the program is run (which I can't figure out how to do). Could anyone help me figure out how to do this? I don't need a code written up doing my work for me, but an example would be an extremely huge help!

    public class Project1 {
    public static void main(String args[])
    String s = "Student" + " " + "Names" + " " + "Score 1" + " " + "Score 2" + " " + "Average";
    String a = "Samuel" + " " + "Student" + " " + "100" + " " + "100" + " " + "100";
    String b = "Lindsay" + " " + "Student" + " " + "90" + " " + "86" + " " + "88";
    String c = "Chris" + " " + "Student" + " " + "52" + " " + "58" + " " + "55";


    This is what it's supposed to look like. (hope the link works...)


  2. #2
    Member Staticity's Avatar
    Join Date
    Jul 2011
    My Mood
    Thanked 5 Times in 5 Posts

    Default Re: Coding Problem

    Hey BohmfalkCW,

    The reason it is not encouraged to "Hard Code" through the assignment is because each individual may have different data/names, based on real life applications. This leads into User Input. Hopefully this video will give you an idea of how to begin. There are a plentiful amount of resources out there on the web. Make use of em!

    Java - 6 - Getting User Input
    Simplicity calls for Complexity. Think about it.

  3. #3
    Join Date
    Feb 2012
    Thanked 10 Times in 10 Posts

    Default Re: Coding Problem

    use JOptionPane or Scanner for input. I found Scanner to be more useful.

Similar Threads

  1. Need your help to coding
    By Tony_nguyen19 in forum File I/O & Other I/O Streams
    Replies: 2
    Last Post: November 14th, 2011, 08:58 AM
  2. J2me coding
    By sjaf in forum Java ME (Mobile Edition)
    Replies: 0
    Last Post: September 13th, 2011, 02:47 AM
  3. Help Huffman Coding>>
    By cool_97 in forum What's Wrong With My Code?
    Replies: 35
    Last Post: July 23rd, 2011, 04:27 PM
  4. Help me in java coding
    By smallmac in forum Java Theory & Questions
    Replies: 5
    Last Post: August 2nd, 2010, 09:50 AM
  5. [SOLVED] Is "Public void closeFile()" a problem in the program for AS-Level computing project
    By muffin in forum What's Wrong With My Code?
    Replies: 2
    Last Post: August 5th, 2009, 09:12 PM