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();
...
}
}作者: 張閎鈞 時間: 2018-6-19 19:53
import java.util.Scanner;
public class OP321 {
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)
{
System.out.println("Chinese failed");
}
if(eng<60)
{
System.out.println("English failed");
}
if(math<60)
{
System.out.println("Math failed");
}
if(chi>=60&&eng>=60&&math>=60)
{
System.out.println("All Pass");
}
}
}
複製代碼
作者: 巫沛庭 時間: 2018-6-19 19:58
本帖最後由 巫沛庭 於 2018-6-19 20:06 編輯
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)
{
System.out.println("Chinese faild.");
}
if(eng<60)
{
System.out.println("English faild.");
}
if(math<60)
{
System.out.println("Math faild.");
}
if(chi>=60 && eng>=60 && math>=60)
{
System.out.println("All Pass.");
}
}
}
複製代碼
作者: 巫晉宇 時間: 2018-6-19 20:15
import java.util.Scanner;
public class JPA01 {
static Scanner o= new Scanner(System.in);
public static void main(String[] args) {
// TODO 自動產生的方法 Stub
test();
test();
test();
test();
}
private static void test() {
// TODO 自動產生的方法 Stub
System.out.print("Input Chinese score:");
int c = o.nextInt();
System.out.print("Input English score:");
int e = o.nextInt();
System.out.print("Input Math score:");
int m = o.nextInt();
if(c<60)
{
System.out.println("Chinese failed");
}
if(e<60)
{
System.out.println("English failed");
}
if(m<60)
{
System.out.println("Math failed");
}
else
{
System.out.println("All past");
}
}