高分求java编程

来源:百度知道 编辑:UC知道 时间:2024/07/04 18:21:35
程序步骤要求:
编写一个程序,读取一个15位以内的数字,或者读取一个日期(日/余月/年)。此程序应该把所读取的数字和日期分清,然后按字母顺序输出。例如输入数字“234334564456455”,则输出应为:“234,334,564,456,455 is two hundred thirty four trillions and three hundred thirty four billions and five hundred sixty four millions and four hundred fifty six thousands and four hundred fifty five”;例如输入日期“23/3/1996”,则输出应为“March 23, 1996”。另:请将此程序分解为多个程式来做,而不是用一个大程式解决所有问题。
多谢高手帮忙!

日 算法挺麻烦 34 是thirty four 11又是eleven
大概可以完成你所说的功能
package javati;

import java.util.*;

public class zhuanhuan
{
public static void main (String[] args)
{
String input="" ;
Scanner in=new Scanner(System.in);
System.out.println("请输入一个数");
input=in.nextLine();
char []c=input.toCharArray() ;
int a=c.length;
int b=a/3;
for(int i=0;i<c.length-2;i=i+3)
{
b--;
if(c[i]=='1')
System.out.print("one hundred ");
else if(c[i]=='2')
System.out.print("two hundred ");
else if(c[i]=='3')
System.out.print("three hundred ");
else if(c[i]=='4')
System.out.print("four hundred ");
else if(c[i]=='5')
System.out.print("five hundred ");
else if(c[i]=='6')
System.out.print("six hundred ");
else if(c