⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exercise5_2.java

📁 Introduction to java programming 一书中所有编程练习部分的源码
💻 JAVA
字号:
import javax.swing.JOptionPane;public class Exercise5_2 {  public static void main(String[] args) {    // Prompt the user to enter the first number    String numberString = JOptionPane.showInputDialog(null,      "Enter an integer");    int max = Integer.parseInt(numberString);    int count = 1;    String inputNumbers = max + " ";    // Prompt the user to enter the remaining five numbers    for (int i = 1; i <= 5; i++) {      numberString = JOptionPane.showInputDialog(null,        "Enter an integer");      int temp = Integer.parseInt(numberString);      inputNumbers += temp + " ";      if (temp > max) {        max = temp;        count = 1;      }      else if (temp == max)        count++;    }    JOptionPane.showMessageDialog(null,      "The array is: " + inputNumbers + "\n" +      "max is " + max + "\n" +      "the occurrence count is " + count);    System.exit(0);  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -