public class Transcript {
private List<Grade> grades = new ArrayList<Grade>();
private int id;
public void assignVariables(){
for(int i = 0; i < grades.size(); i++){
if(grades.get(i).getLetter() == null){
grades.get(i).setLetter(GPA2Letter(grades.get(i).gradePoint()));
}
}
}
public class Registrar {
static double gpa;
public Registrar(){
}
public static double letter2Point(String gradeIn){
if(gradeIn == "A" ){
gpa = 4.0;
}
else if(gradeIn == "B"){
gpa = 3.0;
}
else if(gradeIn == "C"){
gpa = 2.0;
}
else if(gradeIn == "D"){
gpa = 1.0;
}
else if(gradeIn == "F"){
gpa = 0;
}
return gpa;
}
public static String GPA2Letter(double gradePointIn){
String letter = "";
if(gradePointIn >= 4){
letter = "A";
}
else if((gradePointIn >= 3) && (gradePointIn < 4)){
letter = "B";
}
else if((gradePointIn >= 2) && (gradePointIn < 3)){
letter = "C";
}
else if((gradePointIn >= 1) && (gradePointIn < 2)){
letter = "D";
}
else if((gradePointIn >= 0) && (gradePointIn < 1)){
letter = "F";
}
}
}
我正在尝试使用GPA2Letter()方法来处理另一个类中的信息我想知道如何访问此方法,或者我是否可以注意到我正在执行此类代码的类不是静态环境