帮忙做一道JAVA的题目

来源:百度知道 编辑:UC知道 时间:2024/06/18 07:29:19
5. Min Max Average
Write a program that asks the user to enter a total of three decimal numbers. After the numbers are entered, the program should ask the user to do the following: Enter 1 to find the maximum of three numbers, enter 2 to find the minimum, or enter 3 to find the average. The result should be displayed along with the three original numbers.
我已经写了这些

String indata= JOptionPane.showInputDialog("enter a total of three decimal numbers,now is the first");
num1 = Double.parseDouble(indata);
String indata1= JOptionPane.showInputDialog("enter the second number");
num2 = Double.parseDouble(indata1);
String indata2= JOptionPane.showInputDialog("enter the third number");
num3 = Double.parseDouble(indata2);

String indata3= JOptionPane.showInputDialog("enter 1 to find out the maximum,enter 2 to findout the minimun,enter 3 to find out the average");
n

//做好个GUI图形界面的,楼主拿去玩玩吧~~
// NumberTestGUI.java
import javax.swing.*;
public class NumberTestGUI{
int len;
int[] a;
int count;
NumberTestGUI(){
try{UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());}catch(Exception e){}
JOptionPane.getRootFrame().setAlwaysOnTop(true);
int cont = JOptionPane.showConfirmDialog(null,"这是一个对您输入的几个整形数进行分析,然后计算最大值,最小值和平均值的小程序,是否继续?","提示消息:",JOptionPane.OK_OPTION);
if(cont!=JOptionPane.OK_OPTION)return;
int tmp = 0;
while(tmp<3){
String rv = JOptionPane.showInputDialog(null," 请先预先设置您要输入的整形数的个数,至少3个: ","3");
try{
tmp = Integer.valueOf(rv.trim());
}catch(Exception e){
JOptionPane.showMessageDialog(null,"请输入一个整形数!","输入错误:",JOptionPane.WARNING_MESSAGE);
}
}
len = tmp;
a = new int[len];
while(count<len){
String t = J