lost
- From: "CPSCmajor" <bmerritt1987@xxxxxxxxx>
- Date: 29 Oct 2005 12:53:16 -0700
Write a program that reads in the names and scores of students and then
computes and displays the names of the students with the highest and
lowest scores.
A simple method of carrying out this task would be to have two parallel
arrays.
String[] names;
int[] scores;
However, you should avoid parallel arrays in your solution.
First, write a class Student to solve the parallel array problem. Leave
the StudentScores class and tester class for the following exercises. A
Student simply holds a student name and a score.
What is your Student class?
Here is my Student class...
public class Student
{
// instance variables
private String name;
private int score;
private int s;
/**
* Constructor for objects of class StudentScores
*/
public Student()
{
String name = "null";
int score = 0;
}
public String getName() // Gets the name of the Student
{
return name;
}
public int addScore(int s) // Add the new quiz grade to the others
{
score = score + s;
return score;
}
}
I can't come up with the Student Scores class though, I don't even know
where to start. Any ideas?
.
- Follow-Ups:
- Re: lost
- From: Rhino
- Re: lost
- Prev by Date: tictactoe
- Next by Date: Re: Desing Question re Multiple Constructors
- Previous by thread: tictactoe
- Next by thread: Re: lost
- Index(es):
Relevant Pages
|