Today I will show you how to Convert numbers or Amount in words.
This is simple but mostly used tool / function in many Applications.
It also use in reporting to display amount in words form.
I am writing simple programs which converts numbers into word in Java but can also make it in other languages like C#, Php, JavaScript etc easily.
First Below is Source code For Java
This is simple but mostly used tool / function in many Applications.
It also use in reporting to display amount in words form.
I am writing simple programs which converts numbers into word in Java but can also make it in other languages like C#, Php, JavaScript etc easily.
First Below is Source code For Java
sample Output:-public class NumberWordConverter { public static final String[] units = { "", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen" }; public static final String[] tens = { "", // 0 "", // 1 "twenty", // 2 "thirty", // 3 "forty", // 4 "fifty", // 5 "sixty", // 6 "seventy", // 7 "eighty", // 8 "ninety" // 9 }; public static String convert(final int n) { if (n < 0) { return "minus " + convert(-n); } if (n < 20) { return units[n]; } if (n < 100) { return tens[n / 10] + ((n % 10 != 0) ? " " : "") + units[n % 10]; } if (n < 1000) { return units[n / 100] + " hundred" + ((n % 100 != 0) ? " " : "") + convert(n % 100); } if (n < 1000000) { return convert(n / 1000) + " thousand" + ((n % 1000 != 0) ? " " : "") + convert(n % 1000); } if (n < 1000000000) { return convert(n / 1000000) + " million" + ((n % 1000000 != 0) ? " " : "") + convert(n % 1000000); } return convert(n / 1000000000) + " billion" + ((n % 1000000000 != 0) ? " " : "") + convert(n % 1000000000); } public static void main(final String[] args) { final Random generator = new Random(); int n; for (int i = 0; i < 20; i++) { n = generator.nextInt(Integer.MAX_VALUE); System.out.printf("%10d = '%s'%n", n, convert(n)); } n = 1000; System.out.printf("%10d = '%s'%n", n, convert(n)); n = 2000; System.out.printf("%10d = '%s'%n", n, convert(n)); n = 10000; System.out.printf("%10d = '%s'%n", n, convert(n)); n = 11000; System.out.printf("%10d = '%s'%n", n, convert(n)); n = 999999999; System.out.printf("%10d = '%s'%n", n, convert(n)); n = Integer.MAX_VALUE; System.out.printf("%10d = '%s'%n", n, convert(n)); } }
5599908 = 'five million five hundred ninety nine thousand nine hundred eight' 192603486 = 'one hundred ninety two million six hundred three thousand four hundred eighty six' 1392431868 = 'one billion three hundred ninety two million four hundred thirty one thousand eight hundred sixty eight' 1023787010 = 'one billion twenty three million seven hundred eighty seven thousand ten' 1364396236 = 'one billion three hundred sixty four million three hundred ninety six thousand two hundred thirty six' 1511255671 = 'one billion five hundred eleven million two hundred fifty five thousand six hundred seventy one' 225955221 = 'two hundred twenty five million nine hundred fifty five thousand two hundred twenty one' 1890141052 = 'one billion eight hundred ninety million one hundred forty one thousand fifty two' 261839422 = 'two hundred sixty one million eight hundred thirty nine thousand four hundred twenty two' 728428650 = 'seven hundred twenty eight million four hundred twenty eight thousand six hundred fifty' 860607319 = 'eight hundred sixty million six hundred seven thousand three hundred nineteen' 719753587 = 'seven hundred nineteen million seven hundred fifty three thousand five hundred eighty seven' 2063829124 = 'two billion sixty three million eight hundred twenty nine thousand one hundred twenty four' 1081010996 = 'one billion eighty one million ten thousand nine hundred ninety six' 999215799 = 'nine hundred ninety nine million two hundred fifteen thousand seven hundred ninety nine' 2105226236 = 'two billion one hundred five million two hundred twenty six thousand two hundred thirty six' 1431882940 = 'one billion four hundred thirty one million eight hundred eighty two thousand nine hundred forty' 1991707241 = 'one billion nine hundred ninety one million seven hundred seven thousand two hundred forty one' 1088301563 = 'one billion eighty eight million three hundred one thousand five hundred sixty three' 964601609 = 'nine hundred sixty four million six hundred one thousand six hundred nine' 1000 = 'one thousand' 2000 = 'two thousand' 10000 = 'ten thousand' 11000 = 'eleven thousand' 999999999 = 'nine hundred ninety nine million nine hundred ninety nine thousand nine hundred ninety nine' 2147483647 = 'two billion one hundred forty seven million four hundred eighty three thousand six hundred forty seven'You can Download Sample Source Code Here.
what a nice software thanks...elektronik sigara
ReplyDeleteyasal Ukash siparişi
ReplyDeletevereceğiniz yasal ukash kart satış sitesinin yasal ve güvenilir
olduğunu nasıl öğrenebilirsiniz. Bahsettiğimiz bu hususta
yapmanız gereken ukash satın alacağınız sitenin “Türkiye Resmi
Reselleri” olup olmadığını sorgulamanızdır. Belirtmek istediğim
başka bir hususi durum ise güçlü bir bünye’ye sahip olan ukash
siteleri her zaman müşteri hizmetlerine önem vermektedir. Ukash
alımları gerçekşetireceğiniz internet sitesinin bağlı olduğu
firmanın sabit numarası, adresi ve firma bilgileri yer alıp
almadığını kontrol edin. Bahsi geçen bu firma “kurumsal künye”
bilgilerini firma iletişim kısımında yer alıyorsa güvenle firma
üzerinden ukash kart alımlarınızı gerçekleştirebilirsiniz.
Güvenilir ukash siteleri arasından bir kaç tanesinden sizlere
bahsedeceğim.
Ucuz Paykasa Satin Al
ReplyDeleteGüncel fiyat listesi ile ucuz, hızlı ve güvenlidir. yedi yirmidört müşteri temsilcimiz sizlere açıktır. Uzun yıllar boyu paykasa satışını temsillenmiş paykasasatınalgentr tekrar sizler için açılıyor. Ayrıca sitemizin içinde paykasa hakkında aklınızda kalan soruları sorabilirsiniz. İyi alişverişler