• Post Reply Bookmark Topic Watch Topic
  • New Topic

I need your helpe PLZ.

 
Mohd Saad
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Total marks and grade for cours are stored in results file whiich has the following formay:
StudentID:total marks:grade
101010:67:5
202020:54:4
505050:37:2
Each line in the above file represents a Result for one student.
write a class ResultInfo which has the following methods:
public int getGrade(int student_id)-> return the grade for the Student id.
public int getTotal(int student_id)-> return the total marks for the Student by Student id.
public list<Result> getAllResult() ->return all results in the file as list of Result objects.
public Result getResult (int student_id)-> the result object for that student ID only.
public list<Result> getResultByGrade(int grade) ->return all results for that grade only.
The ResultInfo class should read the results file line by line and convert the record on every line to a Result objects, so that they can be used by the above methods.
In addition to the ResultInfo class you should also write the complete Result class which is as shown below. An object of this class represents a Result from the result file.
class Result{
private long studentID =-1;
private int totalMarks =-1;
private int grade =-1;

//add get() and set() methods for each field.
}
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Realize that forum members are here to help answer questions, not do your homework for you.
 
Joe Ess
Bartender
Posts: 9361
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Mohd
While we love to talk about Java, it's painfully obvious that what you've posted here is schoolwork. The only way to learn to write code is to write code, so we are not going to do your work for you. If you do your part, we will help you along your way.
One course of action when writing a program is break down your larger problem into smaller parts and solve each one independently. Learning how to read and write files may be a good start
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!