206及格分數

/******
檔名:JPA02.java
題目:TQC+ JAVA6物件導向程式設計 參考答案
時間:2015/06
作者:fang shi mai
******/
import java.util.*;

public class JPA02
{
    static Scanner keyboard = new Scanner(System.in);
    
    public static void main(String[] args)
    {
        test();
        test();
        test();
        test();
    }
    public static void test()
    {
        int chi, eng, math, avg;
        System.out.print("Input Chinese score:");
        chi = keyboard.nextInt();
        System.out.print("Input English score:");
        eng = keyboard.nextInt();
        System.out.print("Input Math score:");
        math = keyboard.nextInt();
        
        if(chi>=60 && eng>=60 && math>=60)
        {
            System.out.println("All pass.");
        }
        else
        {
            if(chi<60)
                System.out.println("Chinese failed.");
            if(eng<60)
                System.out.println("English failed.");
            if(math<60)
                System.out.println("Math failed.");
        }

    }
}

沒有留言:

張貼留言