hi. i have some questions..howtowrite a program that convert numbers to their equivalent words?
example. 123 become one hundred twenty-three in 3 different language.

import java.util.Scanner;

public class Mynumber {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        System.out.println("Enter the number in digit");
        String number = sc.nextLine();
        String result="";
        Mynumber mn=new Mynumber();

        if (number.length() == 1) {
            result=(mn.getNumber(number));
            System.out.println(result);

        } else if (number.length() == 2) {

        } else if (number.length() == 3) {
            result=(mn.getHundredNumber(number));
            System.out.println(result);

        } else if (number.length() == 4) {
            result=(mn.getThousandNumber(number));
            System.out.println(result);

        } else if (number.length() == 5) {

        } else if (number.length() == 6) {

        } 
    }

    public String getNumber(String n){
        String str = null;
        int number=Integer.parseInt(n);
        if(number==1){
            str=("One");
        }

        return str;
    }
    public String getHundredNumber(String n){
        String str = null;
        int number=Integer.parseInt(n);
        if(number==100){
            str=("One hundred");
        }

        return str;
    }

    public String getThousandNumber(String n){
        String str = null;
        int number=Integer.parseInt(n);
        if(number==1000){
            str=("One Thousand");
        }

        return str;
    }



}

Ok,
This need alot of work
I hops this is just a start up for you to work

if you need more help, let me know.. thanx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.