Results 1 to 2 of 2
Thread: Java assignment
- 02-17-2008, 08:05 PM #1Member
- Join Date
- Feb 2008
- Rep Power
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.
- 02-18-2008, 12:54 AM #2
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.
- By Snowboardmylife in forum New To JavaReplies: 1Last Post: 04-16-2008, 10:52 AM
- By confused2000 in forum New To JavaReplies: 3Last Post: 11-12-2007, 09:12 AM
- By assamhammad in forum New To JavaReplies: 1Last Post: 11-06-2007, 09:35 PM
- By carlos123 in forum New To JavaReplies: 1Last Post: 11-06-2007, 05:53 PM
- By toby in forum New To JavaReplies: 1Last Post: 08-07-2007, 05:59 AM