我是初学者,有个java程序老是运行不出来,希望大虾们帮帮忙指点一下,具体点最好,急!!!
package yunsuan4;
import javax.swing.JOptionPane;
import java.util.Arrays;
public class YunSuan4{
public static void main(String args[]){
double s;
int[i] a=new {0,0,0,0,0,0,0,0;}
double []b={2,1,0.5,0.2,0.1,0.05,0.02,0.01};
String number = JOptionpane.showInputDialog("请输入一个0到500之间的数:");
int r= Integer.parseInt(number);//将输入的数转化为整形
double l=r/100;
s=5-l;
for(int i=0;i<8;i++){
while(s!=0&&s>b[i]){ s=s-b[i];a[i]=a[i]++;}
}
JOptionPane.showMessageDialog(null,a[i],"要找的零钱是:",JOptionPane.INFORMATION_MESSAGE);
}
public String toString(){
return(a[0]+"俩元"+a[1]+"一元"+a[2]+"五角"+a[3]+"俩角"+a[4]+"一角"+a[5]+"五分"+a[6]+"俩分"+a[7]+"一分");}
}