Hey im having trouble making the tester part of a program. In the first part I made a class named student:

public class Student {

	private String name;
	private int idnumber;
	private double gpa;
	private int credithours;

	public Student(String studentname, int idNumber, double gradepa, int chours) {
		name = studentname;
		idnumber = idNumber;
		gpa = gradepa;
		credithours = chours;

	public String getname() //Accessor Methods 
		return name; 
	public int getidnumber()
		return idnumber; 
	public double getgpa()
	        return gpa; 
	public int getcredithours()
	        return credithours; 

	public String getyear() { //gets students current year
		String year = "";
		if (credithours < 18) {
			year = "The student is currently in first year.";
		else if ((credithours >= 18)&&(credithours < 48)) {
			year = "The student is currently in second years.";
		else if ((credithours >=48)&&(credithours < 78)) {
			year = "The student is currently in third year.";
		else if ((credithours >= 78)&&(credithours < 108)) {
			year = "The student is currently in forth year.";
		else if (credithours > 108) {
			year = "The student is currently in fifth year.";
		return year;


	public String getstanding() { //gets students standing 
		String standing = "";
		if (gpa >= 2.5) {
			standing = "The student is first-class";
		if ((gpa >=1.75)&&(gpa < 2.5)) {
			standing = "The student is second-class";
		if (gpa < 1.75) {
			standing = "The student is third-class";
		return standing;


Now the second part of the question is:

a. Declare a 1-D array of n (given as input) Student objects. Then, for each student, input name, id
number, grade point average and number of credits, create a Student object and store it in the
b. Determine and output:

the name and id number of each fourth-year student with first-class standing, a count of the number of first-year students, and all attribute values for each first-year student.

I just don't understand how to work the 1-D array. I do not just want the answer but any tips or pushes in the right direction would greatly be appreciated.
Thanks, dave

5 Years
Discussion Span
Last Post by kekkaishi
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.