Question: Making use of class Results shown below, repeat the above program, this time writing/reading objects of class Result. (When displaying the names and marks that
Making use of class Results shown below, repeat the above program, this time writing/reading objects of class Result. (When displaying the names and marks that have been read, of course, you must make use of the methods of class Result.) Once again, redirect initial input to come from your text file.
class Result implements java.io.Serializable
{
private String surname;
private int mark;
public Result(String name, int score)
{
surname = name;
mark = score;
}
public String getName()
{
return surname;
}
public void setName(String name)
{
surname = name;
}
public int getMark()
{
return mark;
}
public void setMark(int score)
{
if ((score>=0) && (score<=100))
mark = score;
}
}
Step by Step Solution
3.38 Rating (154 Votes )
There are 3 Steps involved in it
import javaio public class Main public static void mainString args try Writing obje... View full answer
Get step-by-step solutions from verified subject matter experts
