標題:
[模擬考]TQC+ 206
[打印本頁]
作者:
王彥甯
時間:
2017-6-10 12:20
標題:
[模擬考]TQC+ 206
完成 TQC+ 206題目
作者:
王彥甯
時間:
2017-6-10 12:20
import java.util.*;
public class JPA02 {
static Scanner keyboard = new Scanner(System.in);
public static void main(String[] args) {
test();
test();
test();
test();
}
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 & eng>=60)
{
System.out.println("Math failed");
}
else if(math>=60 & eng>=60)
{
System.out.println("Chinese failed");
}
else if(chi>=60 & math>=60)
{
System.out.println("English failed");
}
else
{
System.out.println("Chinese failed");
System.out.println("English failed");
System.out.println("Math failed");
}
}
}
複製代碼
作者:
張健勳
時間:
2017-6-10 12:23
import java.util.*;
public class JPD02 {
static Scanner keyboard = new Scanner(System.in);
public static void main(String[] args) {
test();
test();
test();
test();
}
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>59 && eng>59 && math>59)
System.out.println("All pass.");
else if(chi <60)
System.out.println("Chinese failed.");
else if(eng <60)
System.out.println("english failed.");
else if(math <60)
System.out.println("math failed.");
}
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/)
Powered by Discuz! 7.2