java beginners 1 Answer(s) 3 years and 4 months ago
Posted in : Java Beginners
to Write a program to convert entered number into words. Output : You have entered number = 356 The number in words is = three five six.
thanks
View Answers
January 18, 2010 at 4:45 PM
Hi Friend,
Try the following code:
import java.util.*; public class NumberToWords{ static final String[] Number1 = {""," Hundrad"}; static final String[] Number2 = {"","One","Two", "Three","Four","Five", " Six"," Seven", "Eight"," Nine","Ten" }; String number(int number){ String str; if (number % 100 < 10){ str = Number2[number % 100]; number /= 100; } else { str= Number2[number % 5]; number /= 5; } if (number == 0) return str; return Number2[number] + "hundred" + str; } public String convert(int number) { if (number == 0){ return "zero"; } String pre = ""; String str1 = ""; int i = 0; do { int n = number % 100; if (n != 0){ String s = number(n); str1 = s + Number1[i] + str1; } i++; number /= 100; } while (number > 0); return (pre + str1).trim(); } public static void main(String[] args) { NumberToWords number = new NumberToWords(); Scanner input=new Scanner(System.in); System.out.println("Enter four digit Number: "); int n=input.nextInt(); Character c1 = new Character(Integer.toString(n).charAt(0)); Character c2 = new Character(Integer.toString(n).charAt(1)); Character c3 = new Character(Integer.toString(n).charAt(2)); Character c4 = new Character(Integer.toString(n).charAt(3));
java beginners - Java Beginners
the following links:
http://www.roseindia.net/java/beginners/StringTokenizing.shtml
http://www.roseindia.net/java/beginners/tokenizingjavasourcecode.shtml...java beginners what is StringTokenizer?
what is the funciton
Java for beginners - Java Beginners
://www.roseindia.net/java/beginners/index.shtml
Thanks...Java for beginners Hi!
I would like to ask you the easiest way to understand java as a beginner?
Do i need to read books in advance
beginners questions beginners questions I need all the possible Javabeginners questions to prepare for an Interview
Java - Java Beginners
Java how to declare arrays
Hi Friend,
Please visit the following link:
http://www.roseindia.net/java/beginners/array.shtml
Thanks
basic java - Java Beginners
basic java oops concept in java ? Hi Friend,
Please visit the following links:
http://www.roseindia.net/java/beginners/oop-in-java.shtml
http://www.roseindia.net/java/learn-java-in-a-day/oops.shtml
Thanks
java - Java Beginners
java ...can you give me a sample program of insertion sorting...
with a comment,,on what is algorithm..
Hi Friend,
Please visit the following link:
http://www.roseindia.net/java/beginners/arrayexamples
java - Java Beginners
links:
http://www.roseindia.net/java/java-conversion/DecimalToBinary.shtml
http://www.roseindia.net/java/beginners/DataConversion.shtml
Thanks...java write a java program that will read a positive integer
java - Java Beginners
java HOW AND WHERE SHOULD I USE A CONSTRUCTOR IN JAVA PROGRAMMING???
Hi Friend,
Please visit the following links:
http://www.roseindia.net/java/beginners/Construct.shtml
http://www.roseindia.net/java/java
java downloads - Java Beginners
information.
http://www.roseindia.net/java/beginners/download_jdk.shtml...java downloads hi friends,
i would like to download java1.5 .so if possible please send the link for java1.5 free download Hi friend
java - Java Beginners
java hi!! i want 2 download jdk latest version so can u pls send me the link..? Hi Friend,
Please visit the following link:
http://www.roseindia.net/java/beginners/download_jdk.shtml
Thanks
java beginners - Java Beginners java beginners
pl. tell me in System.out.print() what is System , what is out , print is method name .
is System is a package of class name
thanks Hi Friend,
System: It is a standard java class
java beginners - Java Beginners java beginners pl. let me know the answers of the following questions :
1) A program is unable to create objects of a class declared globally. what could be the problem wtih this construcotr
2) what is the benefit
java beginners - Java Beginners java beginners
pl. let me know how to exterat the decimal numbers from a number
i want a java program for it
Example if
input 12.453
OUTPUT 12
.453
if input 25.7657
OUTPUT 25
Program - Java Beginners
Program Java link list I need program in Java to copy a file to another file Hi Friend,For more informationhttp://www.roseindia.net/java/beginners/linked-list-demo.shtml
java beginners - Java Beginners java beginners
let me know the java code for the followign patteren
*00
**0
***
**0
*0
0 means space
whereever the stars are there that is the pattern
class user
{
public static void main(String
java beginners - Java Beginners java beginners pl. let me know the java program to get the following patteren
pl. can i I get it today itself . thank you regargd
a a a a a a
a a
a a
a a
a
and the bewlow
java beginners - Java Beginners java beginners thanks for the suggestion
so I am sending the patteren in place of dots i want blank space
aaaaaaaaaaaaaaaa
a............a
a........a
a.....a
a...a
a
thanks
java beginners - Java Beginners java beginners the pattern was not in this format
*
* * *
* * * * *
* * * * * * *
it is like this
*
* * *
* * * * *
* * * * * * *
thanks
Hi Friend,
If you want the following
java beginners - Java Beginners java beginners please let me know
what is the difference between signed and unsigned integer
thanks
regards
bhavna
Hi Friend,
Differences:
1)Signed integer can be a negative number whereas
java beginners - Java Beginners java beginners
Q. 1 How is class related to data abstraction?
Q. 2 what is the relationship between a class and an object?
thanks Hi Friend,
1)Data Abstraction is used to hide certain details that we
java beginners - Java Beginners java beginners
what are real constant? give some example of real constant.
which of the following is the valid real constant.
2.0, -16.0, +15/2, 1.9E, 189.E4, 0.67E3.6 Hi Friend,
A real constant is a real
java beginners - Java Beginners java beginners
the patteren u received is not the actual patteren which i need the program
i don't know why the patteren does not reach in proper formate to you .
it was in upside down triangle form .
at the top
Java basics - Java Beginners
://www.roseindia.net/java/beginners/Varconstltr.shtml for more code and examples on Java...literals in java program Why we use literals in java program? Hello,A literal is the source code representation of a fixed value
java beginners - Java Beginners java beginners pl. let me know the the following
1) difference between parameters and arguments
2) differentiate between recursive funciton and overloaded function
thanks Hi Friend,
1)
Parameter
java beginners - Java Beginners java beginners is there any other way to do this ?
i want to do by using charAt() function and by decreasing the ascii code by 2 .
Write a program to encode a message. The idea is to shift each letter of a alphabet
java beginners - Java Beginners java beginners
pl. let me know the program for the following question.
A Cyber Café charges for the usage of computer according.../= per minute
Write a java program to accept number of hours he worked and print
Queue - Java Beginners
Queue i'm working with queue on java. since im beginners im asking for additional example programs on queue using java to enhance my knowledge. thanks so much for the help! God bless
Java - Java Beginners
:
http://www.roseindia.net/java/beginners/AddTwoBigNumbers.shtml
Thanks...Java How to add and print two numbers in a java program single...;
System.out.prinln(a+b);
Hi friend,
Code to add two number in java
class
java beginners - Java Beginners java beginners
to Write a program to convert entered number into words.
Output : You have entered number = 356
The number in words is = three five six.
thanks Hi Friend,
Try the following
java compilation error - Java Beginners java compilation error Hello madam/sir, i m a beginners in java. My problem is that i want to connect a login form to a frame containing 4 panels. how could i do it?Please help
java - Java Beginners
);
}
}
For more information on java visit to :
http://www.roseindia.net/java/beginners
array - Java Beginners
array WAP to perform a merge sort operation. Hi Friend,
Please visit the following link:
http://www.roseindia.net/java/beginners/arrayexamples/mergeSort.shtml
Hope that it will be helpful for you.
Thanks
matrices - Java Beginners
matrices Write a program to add the two matrices Hi Friend,
Please visit the following link:
http://www.roseindia.net/java/beginners/MatrixSum.shtml
Hope that it will be helpful for you.
Thanks
java - Java Beginners
:
http://www.roseindia.net/java/beginners/Construct.shtml
http...java Java always provides default constructor to ac lass is it true... constructor.If we don't create any constructor for a class java itself creates
Static method in java - Java Beginners
Static method in java What are static method in Java Hi Friend,
Please visit the following link:
http://www.roseindia.net/java/beginners/howtoaccessstaticmethod.shtml
Hope that it will be helpful for you
help - Java Beginners
to :
http://www.roseindia.net/java/beginners/what-is-java.shtml
http://www.roseindia.net/java/beginners/where-java.shtml
http://www.roseindia.net/java...help what is java and where we use java? Hi friend
java - Java Beginners
links:
http://www.roseindia.net/java/wrapper-class/wrapper-classes.shtml
http://www.roseindia.net/java/beginners/vectordemo.shtml
Thanks...java What is the difference between Wrapper Class and Vector Class
Java programming - Java Beginners
to :
http://www.roseindia.net/java/beginners/index.shtml
Thanks...Java programming hi sir, my question are as follows...
hope u can solve my java programming problem..
Write a program to develop a class to hold
java related - Java Beginners
/
http://www.roseindia.net/java/beginners/
Thanks...java related Hello sir,
I want to learn java. But I don't know where to start from. I have purchased one java related book. But I am
java programming problem - Java Beginners
..
http://www.roseindia.net/java/beginners/java-word-count.shtml
http://roseindia.net...://www.roseindia.net/java/beginners/java-word-count.shtml
http://roseindia.net/java...java programming problem Hello..could you please tell me how can I
examples - Java Beginners
examples as am new to java can you please help me with basic programs on java with their examples Hi Friend,
Please visit the following link:
http://www.roseindia.net/java/beginners/index.shtml
Hope
program - Java Beginners Java vector program Please give me an example of Java vector program.Thanks!! hi friendNow, read about vector program. Here, is the used without taking user input.http://www.roseindia.net/java/beginners
small java project - Java Beginners
small java project i've just started using java at work and i need to get my self up to speed with it, can you give me a small java for beginners project to work on.
your concern will be highly appreciated
small java project - Java Beginners
small java project i've just started using java at work and i need to get my self up to speed with it, can you give me a small java for beginners project to work on.
your concern will be highly appreciated