Number Convert 1 Answer(s) 5 years ago
Posted in : Java Beginners
View Answers
May 22, 2008 at 7:40 PM
Hi
import java.io.*;
public class NumberToWord { String string; String a[]={"","one","two","three","four","five","six","seven","eight","nine",}; String b[]={"hundred","thousand","lakh","crore"}; String c[]={"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","ninteen", }; String d[]={"twenty","thirty","fourty","fifty","sixty","seventy","eighty","ninty"};
public String convertNumber(int count){ int in=1; int num ; string=""; while (count != 0){ switch (in){ case 1: num = count % 100; passString(num); if( count > 100 && count % 100 != 0 ){ displayOutput("and ") ; } count /= 100 ; break ; case 2: num = count % 10 ; if ( num != 0 ){ displayOutput(" ") ; displayOutput(b[0]); displayOutput(" "); passString(num); } count /= 10 ; break ;
case 3 : num = count % 100 ; if ( num != 0 ){ displayOutput(" ") ; displayOutput(b[1]) ; displayOutput(" ") ; passString(num) ; } count /= 100 ; break ; case 4 : num = count % 100 ; if (num != 0){ displayOutput(" "); displayOutput(b[2]); displayOutput(" "); passString(num) ; } count /= 100 ; break ;
case 5 : num = count % 100 ; if (num != 0){ displayOutput(" ") ; displayOutput(b[3]) ; displayOutput(" ") ; passString(num) ; } count /= 100 ; break ;
} in++ ; } return string; }
public void passString(int number){ int num, q ; if (number < 10 ){ displayOutput(a[number]) ; } if (number > 9 && number < 20 ){ displayOutput(c[number-10]) ; } if ( number > 19 ){ num = number % 10 ; if ( num == 0 ){ q = number / 10 ; displayOutput (d[q-2]) ; } else{ q = number / 10 ; displayOutput(a[num]); displayOutput(" ") ; displayOutput(d[q-2]); } } }
public void displayOutput(String s){ String t ; t= string ; string= s ; string+= t ; }
public static void main(String args[]) throws IOException{ BufferedReader buff = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Display massage number to Text!"); NumberToWord num=new NumberToWord(); System.out.println("Number to word: "+num.convertNumber(10)+"."); System.out.println("Number to word :"+num.convertNumber(15)+"."); System.out.println("Number to word :"+num.convertNumber(50)+"."); System.out.println("Number to word :"+num.convertNumber(99)+"."); System.out.println("Number to word :"+num.convertNumber(150)+"."); System.out.println("Number to word :"+num.convertNumber(234)+"."); System.out.println("Number to word :"+num.convertNumber(250)+"."); } }
Related Pages:
Number Convert - Java Beginners Number Convert Dear Deepak Sir,
I am entered in Command prompt Some value like 234.Value can be convert into Two Hundred and Thirty Four Rupees... passString(int number){
int num, q ;
if (number < 10 ){
displayOutput(a[number
Convert Number to Binary ConvertNumber to Binary
In this section, you will learn to convert a number
to a binary (0,1). The given number is a decimal format and the following
program to calculate its
Convert Number To Words ConvertNumber To Words
In this example, We are going to convertnumber to words.
Code...;
}
public String convert(int number
Convert String to Number Convert String to Number
In this section, we will learn how to convert String to Number.
The following program provides you the functionality to convert String
Convert Number to Roman Number Using Java
Java ConvertNumber to Roman Numerals
In this section, you will learn how to convert the number to roman
number. To do this, we have created a class... and the method convertIntegerToRoman(int n)
convert the specified number into roman
PHP convert week number to days or month - PHP
PHP convert week number to days or month Small, simple and easy code that can do following task:
1.Convert Week Numbers to Month
2.Convert Week to Date
Generally, we use the date time object in PHP to convert the date
jQuery Convert string to number
jQuery Convert string to number
In this tutorial , we will discuss about how to convert string (enter into
input box) into number. In this example... it from input and also need to
convert into number. We can do this by following
Convert Hexadecimal number into Integer Convert Hexadecimal number into Integer ... to convert hexadecimal
data into integer. The java.lang
package provides the functionally to convert the hexadecimal data into an
integer type data.
Code
Java Convert Number to Words
Java ConvertNumber to Words
In this section, you will learn how to convert...", "ninty" };
public String convert(int number) {
int n = 1;
int word...) are generally accepted.
However, once a number to be converted reaches a value
Convert Number to String ConvertNumber to String
In this section, we will learn how to convert numbers
to String.
The following program provides you the functionality to convert numbers to
String
Convert Number Format ConvertNumber
Format
 ... about converting a
String value in the page to the Number object. When converting,
minimum and maximum number of digits in the integer
Convert Decimal into Binary Convert Decimal into Binary
In this section, you will learn to convert decimal
number...; a decimal number into a binary number.
Description of program:
This program
Convert Decimal to Integer Convert Decimal to Integer
In this section, you will learn to convert a decimal number
into an integer. The java.lang package provides the
functionality to convert
Convert Decimal to Octal Convert Decimal to Octal
In this section, you will learn to convert decimal
number into octal...) with base 10. The octal
number has 8 digits (as: 0,1,2,3,4,5,6,7) with base 8
convert to GUI convert to GUI import java.util.Scanner;
public class Exam
{
public static void main (String args[])
{
int numberStudent, mark, markAplus = 0... Scanner(System.in);
System.out.print("Please enter number of students in class
Convert Binary to Decimal Convert Binary to Decimal
 ... number into a decimal number. The java.lang package provides the facility
to convert the integer data into the binary to decimal.
Code Description
Convert Hexa To Char
;
In this example, you will learn how to convert
hexadecimal to char number. The following program provides you convert it into the hexa to
char number.
Code... string. This program takes a hexadecimal number at console and
convert
Convert Decimal To Fraction Convert Decimal To Fraction
In this example, you will learn how to convert decimal
number... will also learn how to convert a
decimal number into fraction with the help
Number conversion in JavaScript Number conversion in JavaScript How do you convert numbers between different bases in JavaScript
Convert Octal to Decimal Convert Octal to Decimal
In this
section, you will learn to convert an octal number to decimal. The following
program helps you converts number octal to decimal. 
from number to word
from number to word i want to know weather there is any method that can be use in changing value from number to word. Example if i write ten thousand, it will automatically be written as 10000.
Java convertnumber
Number Format Exception
. A Number Format Exception occurs in the java code when a programmer
tries to convert a String into a number. The Number might be int,float or any
java...
Number Format Exception
 
Convert Byte to Hexadecimal Convert Byte to Hexadecimal
In this section, We are going to convert a byte value into
a hexadecimal number. The package java.lang provides the functionality
Convert Decimal To Character
. In
this example, we are going to convert decimal number to its corresponding
character... Convert Decimal To Character
 ... to convert the decimal into the corresponding
character..
Here is the code
Convert a String to Hexa Convert a String to Hexa
In the example given below, you will learn how to
convert String to hexadecimal number. This example takes a user input
string and convert
convert it to BufferedReader class convert it to BufferedReader class import java.util.*;
public class... ("The large number is "+maximum);
System.out.println ("The small number is "+minimum...(System.in));
System.out.print ("Enter First number: ");
num1=Integer.parseInt
Java Convert Octal to Binary
Java Convert Octal to Binary
In this tutorial, you will learn how to convert octal to binary.
Java has provide different ways to change the number system of different
numbers. You can convert and decimal to octal, decimal to binary
Convert the code to GUI ?? Convert the code to GUI ?? hi >>
can anyone help me to conver this code to GUI ??
/**
* @(#)RegistorClass.java
*
*.
* @author... ***");
System.out.println("*** the location number and a question mark
convert this code to GUI convert this code to GUI hello..
this is my code..
import... Scanner(System.in);
System.out.print("Enter number of students in class... JLabel("Enter number of students in class: ");
final JTextField text=new
convert this code to GUI convert this code to GUI hello..
this is my code..
import... Scanner(System.in);
System.out.print("Enter number of students in class... JLabel("Enter number of students in class: ");
final JTextField text=new
convert this code to GUI convert this code to GUI hello..
this is my code..
import... Scanner(System.in);
System.out.print("Enter number of students in class... JLabel("Enter number of students in class: ");
final JTextField text=new
convert this code to GUI convert this code to GUI import java.util.Scanner;
public class...) {
Scanner input = new Scanner(System.in);
System.out.print("Enter number... void main(String[] args) {
JLabel lab=new JLabel("Enter number
convert this code to GUI convert this code to GUI import java.util.Scanner;
public class...) {
Scanner input = new Scanner(System.in);
System.out.print("Enter number... void main(String[] args) {
JLabel lab=new JLabel("Enter number
convert this code to GUI convert this code to GUI import java.util.Scanner;
public class...) {
Scanner input = new Scanner(System.in);
System.out.print("Enter number... void main(String[] args) {
JLabel lab=new JLabel("Enter number
convert this code to GUI convert this code to GUI import java.util.Scanner;
public class...) {
Scanner input = new Scanner(System.in);
System.out.print("Enter number... void main(String[] args) {
JLabel lab=new JLabel("Enter number
convert this code to GUI convert this code to GUI import java.util.Scanner;
public class...) {
Scanner input = new Scanner(System.in);
System.out.print("Enter number... void main(String[] args) {
JLabel lab=new JLabel("Enter number
convert this code to GUI convert this code to GUI import java.util.Scanner;
public class...) {
Scanner input = new Scanner(System.in);
System.out.print("Enter number... void main(String[] args) {
JLabel lab=new JLabel("Enter number
convert this code to GUI convert this code to GUI import java.util.Scanner;
public class...) {
Scanner input = new Scanner(System.in);
System.out.print("Enter number... void main(String[] args) {
JLabel lab=new JLabel("Enter number
Convert the code to GUI Convert the code to GUI can any one convert My code to GUI code
import java.util.Scanner;
public class RegistorClass {
private int.... I will display ***"); System.out.println("*** the location number
Java Convert date to words
Java Convert date to words
In this tutorial, you will learn how to convert date into words.
Just like a number, you can also convert a date into words. Here... convert(int number){
int n = 1;
int word;
string = "";
while (number
Convert Decimal to Hexadecimal Convert Decimal to Hexadecimal
In this
section, you will learn to convert a decimal data into hexadecimal. The java.lang package provides the
functionality to convert a decimal
Convert Hexadecimal to Decimal Convert Hexadecimal to Decimal
In this section, you will learn to change
hexadecimal number into decimal. The java.lang package provides the
functionality to convert
Convert the code to GUI
("*** the location number and a question mark (?) ***"); System.out.println("*** You
convert to java plss - Java Beginners convert to java plss hi i am using microsoft VB6.0 and my friend ask me to make java program to convertnumber to words but i only use visual basic... Number2[number] + "hundred" + str;
}
public String convert(int number
How to convert date to time in PHP?
How to convert date to time in PHP? Hi, programmer.
The PHP..., a number representing the number of seconds since January 1, 1970 Greenwich Mean Time (GMT). This number is handy for generating unique and random numbers
Convert Binary to Hexadecimal Convert Binary to Hexadecimal
In this section, you will learn to convert binary data
into hexadecimal. The
java.lang package provides the functionality to convert
Convert Text to Binary
bytes as we have declared maxBytes=3. Hence it
will convert the number... Convert Text to Binary
In this section, we will learn how to convert Text to Binary
Convert Text to Binary Convert Text to Binary
In this section, we will learn how to convert Text to Binary.
The following program provides you the functionality to convert Text
java Application Convert to java Applet
java Application Convert to java Applet Hi every Java Masters i'm Java beginner ,and i want below this figures source code convert to Java Applet...();
System.out.println();
switch(menu) {
case 1:
System.out.print("Enter Number of Day