Preface: I am new at this. Here is the source code file that won't compile because I get the error message that "method next double in class Random cannot be applied to given types."
import java.util.Random;
public class Student
{
private String name;
private String address;
private String major;
private double GPA;
Random generator = new Random();
public Student (String studName, String studAddr, String studMaj)
{
name = studName;
address = studAddr;
major = studMaj;
GPA = generator.nextDouble(.5, 4.0);
}
public Student (String studName, String studAddr)
{
name = studName;
address = studAddr;
major = "undeclared";
GPA = generator.nextDouble(.5, 4.0);
}
Aucun commentaire:
Enregistrer un commentaire