JAVA学分绩点转换小工具

import java.text.DecimalFormat; 
import java.util.Scanner; 
 
public class GradePoint { 
 public int count = 0;  // 课程的序号 
 public int score = 0;  // 课程的成绩  
 public double point = 0; // 某门课程的成绩学分  
 public double points = 0; // 某门课程的学分绩点  
 public String rank = ""; // 课程的成绩等级 
   public double calPoint(int x) {  // 计算成绩学分 
  if (x >= 60) { 
   return (x - 60) / 10.0 + 1; 
  } else { 
   return 0; 
  }  
 }  public String calRank(double y){ // 计算成绩学分的等级 
  if (y >= 4) { return "A"; } 
else if (y >= 3) { return "B"; }  
else if (y >= 2) { return "C"; }  
else { return "D"; } 
 } 
 public static void main(String[] args) { 
  GradePoint p = new GradePoint();   System.out.println("请输入成绩"); 
  Scanner input = new Scanner(System.in); 
  double sum = 0; 
  double sumPoints = 0; 
  while (true) { 
   p.count++;    System.out.println("第" + p.count + "门课程的成绩是:"); 
   p.score = input.nextInt(); 
   sum += p.score; 
   if (p.score == 0) {     break;   // 若输入成绩为0,则退出循环 
   }    System.out.println("第" + p.count + "门课程的成绩学分是:"); 
   p.point = p.calPoint(p.score); 
   System.out.println(p.point);    System.out.println("第" + p.count + "门课程的学分绩点是:"); 
p.points = p.point * p.score; 
   System.out.println(p.points); 
   sumPoints += p.points;    System.out.println("第" + p.count + "门课程的成绩等级是:"); 
   p.rank = p.calRank(p.point); 
   System.out.println(p.rank); 
  } 
  DecimalFormat df = new DecimalFormat("0.00");   System.out.println("学期总学分绩点数:"); 
  System.out.println(df.format(sumPoints));   System.out.println("学期平均学分绩点:"); 
  System.out.println(df.format(sumPoints / sum)); 
  input.close(); 
 } 
 
}