返回列表 發帖
本帖最後由 巫沛庭 於 2018-6-19 20:06 編輯
  1. import java.util.*;
  2. public class JPA02 {
  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<60)
  21.        {
  22.               System.out.println("Chinese faild.");
  23.        }
  24.        if(eng<60)
  25.        {
  26.               System.out.println("English faild.");
  27.        }
  28.        if(math<60)
  29.        {
  30.               System.out.println("Math faild.");
  31.        }
  32.        if(chi>=60 && eng>=60 && math>=60)
  33.        {
  34.               System.out.println("All Pass.");
  35.        }
  36.     }
  37. }
複製代碼

TOP

返回列表