Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
/** * AITI Java Laboratory 4: * Gradebook: Methods */ import java.io.*; public class GradeBook { public static void main(String args[]) throws Exception { /** 'scores' stores a student's score */ double[] scores; // = {82.4, 72.6, 90, 96.8, 86.1}; BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); System.out.print("How many scores to enter? "); int size = Integer.parseInt(reader.readLine()); scores = new double[size]; System.out.println("Entering " + size + " scores."); System.out.println("Type each score and press enter."); for (int i=0; i scores[i])?max:scores[i]; return max; } /* Lab 4, Part 2(d) */ public static char letterGrade(double score) { if (score >= 90) return 'A'; else if (score >= 80) return 'B'; else if (score >= 70) return 'C'; else if (score >= 60) return 'D'; else return 'F'; } /* Lab 4, Part 2(e) */ public static void printGrades(double[] scores) { System.out.print("Letter Grades: "); for (int i=0; i