[求助]一个java程序,小弟刚学
能通过编译,但是不能运行。。import java.io.*;
public class money{
public char change1(int a)
{
char c='0';
switch(a){
case 9:c='玖';
case 8:c='捌';
case 7:c='柒';
case 6:c='陆';
case 5:c='伍';
case 4:c='肆';
case 3:c='叁';
case 2:c='贰';
case 1:c='壹';
case 0:c='零';
}
return c;
}
public char change2(int a){
char c='0';
switch(a%4){
case 0:c='元';
case 1:c='十';
case 2:c='百';
case 3:c='千';
}
return c;
}
public void main(String args[]){
float s=0;
System.out.print("请输入个浮点数:");
try{
s=(float)System.in.read();
}
catch(IOException e){
System.err.println(e.toString());
}
int p=(int)s; //取整数部分
float q=s-p;//取小数部分
int A[]=new int[12];//存储每位的数据
int i=0;
for(i=0;p>0;i++)
{
A[i]=p%10;
p=p/10;
}
for(;i>0;i++)
{
System.out.print(change1(A[i]));
if(A[i-1]==0&&A[i]==0){}
else System.out.print(change1(i));
if(i==8)System.out.print("亿");
else if(i==4)System.out.print("万");
}
if(q==0)System.out.println("整");
else{
int j=0;
j=(int)(10*q);
if(j!=0)System.out.print(change1(j)+"角");
else System.out.print("零");
j=(int)(100*q-10*j);
if(j!=0)System.out.print(change1(j)+"分");
}
System.out.println();
}
}