public class Student {

private String name;
private String address;
private String phone;
private String major;

String[] classesTaken = new String[100];
double[] gradesRecived = new double[100];

public void addClassesTaken (String classID) {}
public void addGradeReived(float classGrade){}
public void changeGradesRecieved(String classID, double newGrade){}
public double computeGPA( ) { }

}

I need to randomly fill the gradesReceived array with random values between 0 and 100. I need instant variables private. I need to Populate the class taken whth an empty string. they can both be within the same loop

For the random generated numbers try : Math.random(); . It will return a random double between 0 and 1. You can then multiply with 100 and cast it to an int

I need to Populate the class taken whth an empty string

Add getters and setters for the variables: name, address, phone, major and call them after you have created an instant of the object. Example:

public void setName(String name) {
  this.name=name;
}

public String getName() {
  return name;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.