This article describes the Java implementation of the digital capitalization amount conversion method. Share to everyone for your reference. Specifically as follows:
Example: an implementation that converts the amount of an Arabic numeral to an uppercase amount in Chinese, for example:
¥1011→ 0 to pick one yuan whole.
The capital number is: 0, one, the other, three, the restaurant, Wu, Lu, QI, BA, nine, pick, Bai, Qian, million, billion
import java.io.*; import java.lang.String; public class Change {public static void Mai
N (String agrs[]) {//money is used to hold the amount of input long money=0;
String mon[]={"0", "one", "II", "three", "Restaurant", "WU", "Lu", "Qi", "ba", "Nine"}; String mon1[]={"Pick Up", "Bai", "" Thousand "," Million "," Collect million "," Million "," Thousand Million "," billion "," pick billion "," billion "," Thousand Billion "}, je[]=new string[30];//je[] array for the number of digital amount converted
n is used to test whether you have the amount converted int n=agrs.length;
if (n==0) System.out.println ("Please enter the amount you want to convert:");
Converts the amount entered into a Long type of data else {Money=long.parselong (agrs[n-1]);
//bitt is used to store the number of amounts that need to be converted, int bitt=0,j,k=-1,i=0;
The conversion process while (money!=0) {bitt= (int) (money%10l);
Calculates the uppercase value for (j=0;j<mon.length;j++) {if (J==bitt) break of each number;
///Save the corresponding value in je[] if (k!=-1) {je[i]=mon1[k];i++}
je[i]=mon[j];i++;
MONEY=MONEY/10;
k++;
if (money==0) {//Output converted amount System.out.print ("The amount you entered is:");
i--;
for (; i>=0;i--) System.out.print (Je[i]); }
}
}
}
I hope this article will help you with your Java programming.