零度
天行健,君子以自强不息;地势坤,君子以厚德载物。

郑重声明,尽管这样子不文明,但还是先对这破电脑发泄发泄吧,不对人发泄就没有伤害!

妈蛋,这年头使用电脑太多,离开的电脑就是这么的个东西都写不出来了,真是丢人丢大了!

今天去面试,从市政府做的是8路公交,应聘的是517号金色堤岸写字楼11层,可谓“一生一世要发了”啊!但估计挂了!不是老天不长眼,而是才知道自己有多菜,做项目再多有什么用?????????????????????????????????????????????回来自己在电脑上一试,妈蛋,好简单,手写就是写不出来!讨厌死了!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

 

package numbertochinese;

import java.util.Scanner;

/**
 * @author Administrator
 * 将阿拉伯数字转换为其对应的中文数字
 */
public class NumberTochinese {

 private static String theNumber = null;
 private String theChinese = null;
 
 private String action(String theNumber2){
  String tadi = String.valueOf(theNumber2);
  for(int i=0; i<tadi.length(); i++){
   char mychar = tadi.charAt(i);
   String st = null;
   switch (mychar) {
   case '1':
    st = "一";
    break;
   case '2':
    st = "二";
    break;
   case '3':
    st = "三";
   case '4':
    st = "四";
    break;
   case '5':
    st = "五";
    break;
   case '6':
    st = "六";
    break;
   case '7':
    st = "七";
    break;
   case '8':
    st = "八";
    break;
   case '9':
    st = "九";
    break;
   case '0':
    st = "零";
    break;
   default:
    break;
   }
   if(null == theChinese){
    theChinese = st;
   }else{
    theChinese += st;
   }
  }
  if(null == theChinese){
   return theChinese = "您输入的不是数字!";
  }else if(theChinese.length() != theNumber.length()){
   return theChinese = "您输入的数字不符合规则!";
  }else{
   return theChinese;
  }
 }
 
 public static void main(String[] args) {
  NumberTochinese tochinese = new NumberTochinese();
  System.out.println("请输入一个或多个阿拉伯数字:");
  try {
   Scanner scanner = new Scanner(System.in);
   theNumber = scanner.next();
   tochinese.theChinese = tochinese.action(theNumber);
  } catch (Exception e) {
   e.printStackTrace();
  }
  System.out.println(tochinese.theChinese);
 }
}

posted on 2014-11-24 21:19  青青之兰  阅读(643)  评论(0编辑  收藏  举报