返回列表 發帖
  1. import java.util.*;
  2. public class JPD02 {
  3.     static Scanner keyboard = new Scanner(System.in);
  4.     public static void main(String[] args) {
  5.         test();        
  6.         test();
  7.         test();
  8.         test();
  9.     }
  10.    
  11.     static void test() {
  12.         int chi, eng, math, avg;
  13.         System.out.print("Input Chinese score:");
  14.         chi = keyboard.nextInt();
  15.         System.out.print("Input English score:");
  16.         eng = keyboard.nextInt();
  17.         System.out.print("Input Math score:");
  18.         math = keyboard.nextInt();
  19.         
  20.         if(chi>59 && eng>59 && math>59)
  21.                 System.out.println("All pass.");
  22.         else if(chi <60)
  23.                 System.out.println("Chinese failed.");
  24.         else if(eng <60)
  25.                 System.out.println("english failed.");
  26.         else if(math <60)
  27.                 System.out.println("math failed.");
  28.         
  29.     }
  30. }
複製代碼

TOP

返回列表