public static void main(String[] args) {
int[] numberOfInputs = new int[100];
Scanner scanner = new Scanner(System.in);
for (int i = 0; i <= 100; i++) {
System.out.print("请输入一个整数(输入0结束):");
numberOfInputs[i] = scanner.nextInt();
int verification = numberOfInputs[i];
if (verification == 0){
break;
}
}
int max = 0;
int min = 0;
for (int j = 0; j < numberOfInputs.length; j++) {
if ## 标题(numberOfInputs[j]>numberOfInputs[max]){
max = j;
}
if (numberOfInputs[j]<numberOfInputs[min]){
min = j;
}
}
System.out.println("最大值是:" + numberOfInputs[max]);
System.out.println("最小值是:" + numberOfInputs[min]);
}
public static void main(String[] args) {
int inputValue ;
Scanner scanner = new Scanner(System.in);
System.out.print("请输入数字1-7(输入0以结束):");
for (int i = 0; i < 100; i++) {
inputValue = scanner.nextInt();
if (inputValue<8&&inputValue>0){
System.out.print("今天是 ");
if (inputValue == 1){
System.out.println("MON");
}
if (inputValue == 2){
System.out.println("TUE");
}
if (inputValue == 3){
System.out.println("WED");
}
if (inputValue == 4){
System.out.println("THC");
}
if (inputValue == 5){
System.out.println("FRI");
}
if (inputValue == 6){
System.out.println("SAT");
}
if (inputValue == 7){
System.out.println("SUN");
}
}
else
System.out.println("请重新输入");
}
}
public static void main(String[] args) {
int costOfProduction = 5000;
int month = 0;
System.out.println("请输入您的出行月份:1~12");
Scanner scanner = new Scanner(System.in);
month = scanner.nextInt();
if ((month>=1&&month<4)||(month>10&&month<=12)){
while (true) {
System.out.println("请问您是头等舱还是经济舱?头等舱请输入1,经济舱请输入2");
int cabin = scanner.nextInt();
if (cabin == 1) {
System.out.println("您的机票价格为:" + costOfProduction * 0.5);
break;
}
if (cabin == 2) {
System.out.println("您的机票价格为:" + costOfProduction * 0.4);
break;
}
if (cabin != 1 && cabin != 2) {
System.out.println("请重新输入");
continue;
}
}
}
if (month>=4&&month<=10){
while (true) {
System.out.println("请问您是头等舱还是经济舱?头等舱请输入1,经济舱请输入2");
int cabin = scanner.nextInt();
if (cabin == 1) {
System.out.println("您的机票价格为:" + costOfProduction * 0.9);
break;
}
if (cabin == 2) {
System.out.println("您的机票价格为:" + costOfProduction * 0.6);
break;
}
if (cabin != 1 && cabin != 2) {
System.out.println("请重新输入");
continue;
}
}
}
}