Results 1 to 2 of 2

Thread: Java assignment

  1. #1
    xtianah77 is offline Member
    Join Date
    Feb 2008
    Rep Power

    Post Java assignment

    Will like to know if anyone can assist me with this assignment. I just started the class, and i need help in completing this assignment.


    The first programming project involves writing a program that determines whether a file of student records is in sorted order or not. This program should consist of two classes.

    The first class should contain a main method that prompts the user for the name of the input file. If the input file cannot be opened, the method should continue to reprompt the user for the correct name, until the file can be opened. The file should be read, and the method should verify that the file is in ascending order. If it is not, an appropriate error message should be displayed, and the program should terminate. As the student records are read in, they should be displayed on the screen.

    The second class should be named Student and should implement the predefined interface Comparable. Its instance variables should include first name, last name, an integer number of credits completed, and a floating-point grade-point average. This class should contain the following methods:

    ? A method input that reads in a student record from a file. All the data fields will be separated by at least one space. The order of the fields is first name, last name, credits, and grade point.

    ? A method output that writes out a student record to the screen. The name should be output last name first, separating the last and first names with a comma.

    ? A method compareTo that compares two student records. The names only are compared. The last name is more significant than the first. The method returns a ?1 if the first name is less than the second, a 0 if they are equal, and a 1 if the first name is greater than the second.

    ? A method equals that compares two students. Only the names are compared as with the compareTo method.

  2. #2
    CaptainMorgan's Avatar
    CaptainMorgan is offline Moderator
    Join Date
    Dec 2007
    NewEngland, US
    Rep Power


    Welcome to the Forums xtianah.

    A general rule of thumb around here is that we do not do your homework for you. If you're just starting out, then I recommend reading your assigned textbook. If you can't own a textbook, then I suggest you read Sun's tutorials. Otherwise, if you have at least some clue as to how to program- everything you need to do is in your assignment description, so what exactly is the problem? Your description even goes so far as to tell you the names of methods, names of the class, the interface it may implement and what parameters methods take and what they output. Every step is outlined for you.

    You need to make an attempt at your work before you get help - Help yourself before we help you.

    Considering you're new to the forum you may not have realized this isn't a do-your-homework-for-you-site, regardless you have not started off on the right foot. Read the FAQ before you post again.
    Vote for the new slogan to our beloved Java Forums! (closes on September 4, 2008)
    Want to voice your opinion on your IDE/Editor of choice? Vote now!
    Got a little Capt'n in you? (drink responsibly)

Similar Threads

  1. Java assignment - couple methods don't know how to figure out
    By Snowboardmylife in forum New To Java
    Replies: 1
    Last Post: 04-16-2008, 11:52 AM
  2. Please help... assignment for school
    By confused2000 in forum New To Java
    Replies: 3
    Last Post: 11-12-2007, 09:12 AM
  3. for Assignment plz help
    By assamhammad in forum New To Java
    Replies: 1
    Last Post: 11-06-2007, 09:35 PM
  4. java assignment, need help bad.
    By carlos123 in forum New To Java
    Replies: 1
    Last Post: 11-06-2007, 05:53 PM
  5. Help with my assignment java
    By toby in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 06:59 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