import java.util.Scanner;
public class PrintGader {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Your score is:");
int sc = input.nextInt();
while (sc != 999) {//不固定次数的循环
printGrader(sc);
System.out.print("Your score is:");
sc = input.nextInt();
}
/*固定次数循环:
......................
阅读全部 | 2022年9月27日 11:50
import java.util.Scanner;
public class PrintGader {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Your score is:");
int sc = input.nextInt();
while (sc != 999) {//不固定次数的循环
printGrader(sc);
System.out.print("Your score is:");
int sc = input.nextInt();
}
/*固定次数循环:
......................
阅读全部 | 2022年9月27日 11:46
import java.util.Scanner;
public class PrintGader {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Your score is:");
int sc = input.nextInt();
printGrader(sc);//调用方法
}
public static void printGrader(int score){
if (score<0 || score>100){
System.out.println("The score is invalid.");
}
......................
阅读全部 | 2022年9月27日 11:26
public class PrintGader {
public static void main(String[] args) {
int score = 60;
if (score<0 || score>100){
System.out.println("The score is invalid.");
}
else if(score < 40){
System.out.println("The corresponding is F.");
}
else if(score < 70){
System.out.println("The corresponding is B.");
}
......................
阅读全部 | 2022年9月27日 10:55
import java.util.Scanner;
public class ZhangZiQian {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter weight in kilograms:");
double weight = input.nextDouble();
System.out.print("Enter height in meters:");
double height = input.nextDouble();
double BMI = (weight * 0.45359237) / Math.pow((height * 0.0254), 2);
System.out.println("BMI is " + BMI );
}
......................
阅读全部 | 2022年9月20日 22:49