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.

Results 1 to 5 of 5

Thread: Help me write this program.

  1. #1
    Junior Member
    Join Date
    Dec 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help me write this program.

    Write a program that creates a file containing a table showing the student ID numbers and averages of
    all the students in a course in ascending order by ID number. The input to the program is a file
    containing student records. Each student record consists of a student’s first name, a student’s last name,
    a student’s ID number, and the student’s average. Each of the fields of the record is separated by a
    newline character and there is one newline character separating one student’s record from the next
    record in the file. Each student’s ID number has the following form LDD-DDDDD. L is the letter B,
    M, or P and the D’s are digits. You may assume that the data was validated before it was put in the file.
    You may assume that there will not be more than one hundred student records in the input file.
    Your program must allow the user to enter the names of both the input file and the output file.
    Create a system of parallel arrays to store the data needed from the file. One array should store the
    student’s ID numbers and one array should store the student’s averages. The arrays should be related by
    the subscripts. The first student’s ID number is in the student ID array at subscript 0 and the student’s
    average is the averages array at subscript 0.
    Your program must consist of at least four meaningful methods. For example, you might create a
    method to read the input file and store the necessary data in your arrays, another method that performs
    the sort, and another method that writes the data from the arrays to the output file (your fourth method
    would be your main method). Create additional methods as you find necessary. You must pass data
    between the methods using arguments and parameters. You may not declare any variables globally
    (outside of the methods). There must be a paragraph of comments before each of your methods that
    describes what the method does and what inputs it receives and outputs it returns.
    Modify the selection sort algorithm provided in the text to perform the sort. When you sort the data in
    your arrays you must maintain the relationship between the elements across the parallel arrays. As you
    move an ID number, the corresponding average must also be moved.


  2. #2
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,895
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: Help me write this program.

    Please provide us with what you've tried so far and where you are stuck and we'll be willing to help you, but we won't do if for you. See: The problem with Spoon Feeding.
    Last edited by helloworld922; December 6th, 2011 at 03:42 AM.

  3. #3
    Junior Member
    Join Date
    Dec 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Help me write this program.

    I dont really need the code for anything anymore because i wrote it in these past few hours.
    But i was wondering what a method would be like to order the ID Numbers in Ascending order. I know its a selection sort but i am not sure how
    to go about coding it.

  4. #4
    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 write this program.

    Use a sort to put objects in order.

  5. #5
    Member
    Join Date
    Nov 2011
    Posts
    39
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: Help me write this program.

    Quote Originally Posted by HuKjr View Post
    I dont really need the code for anything anymore because i wrote it in these past few hours.
    But i was wondering what a method would be like to order the ID Numbers in Ascending order. I know its a selection sort but i am not sure how
    to go about coding it.
    Implement a sort algorithm such as Bubble sort or Quick sort. The algorithm and implementation are very popular on the web.

    Spring 3
    Last edited by cafeteria84; January 22nd, 2012 at 04:01 PM.

Similar Threads

  1. How do you write a Java program that displays your initials?
    By kala99 in forum Java Theory & Questions
    Replies: 3
    Last Post: November 30th, 2011, 02:12 PM
  2. How would I write this program?
    By mjballa in forum Java Theory & Questions
    Replies: 2
    Last Post: November 14th, 2011, 11:49 PM
  3. help me write java program
    By stevisto in forum Member Introductions
    Replies: 1
    Last Post: September 13th, 2011, 03:44 PM
  4. how can i write this program
    By lavudyagopi27 in forum Java Theory & Questions
    Replies: 2
    Last Post: September 17th, 2010, 08:11 AM
  5. Someone please help me write a simple program!!!
    By ocean123 in forum Loops & Control Statements
    Replies: 3
    Last Post: June 14th, 2009, 09:46 PM