Page 1 of 1
H Write a program to read a number from keyboard maximum three digits long as a long integer and print it in alphabetic
Posted: Sat Nov 27, 2021 2:33 pm
by answerhappygod

- H Write A Program To Read A Number From Keyboard Maximum Three Digits Long As A Long Integer And Print It In Alphabetic 1 (23.47 KiB) Viewed 96 times

- H Write A Program To Read A Number From Keyboard Maximum Three Digits Long As A Long Integer And Print It In Alphabetic 2 (18.12 KiB) Viewed 96 times
H Write a program to read a number from keyboard maximum three digits long as a long integer and print it in alphabetic spelling form. Consider the following Java code fragment: String[] oneDigit {"","one","two","three", " four"); String ans = oneDigit[2]; // Now ans is equal to two" Note that we can find alphabetic representation of a one digit number using array and index of the array. Study pattern of the numbers and discover how they are repeating themselves, like: 222 that is two hundred twenty two
Expand your program to numbers up to 15-digits long. Note that a long integer can hold a number up to 15-digits long, and it is much easier if you read your number as a long integer. Now study the pattern of the numbers. For example: 222222222 that is two hundred twenty two million, and two hundred twenty two thousand, and two hundred twenty two. As you can see from above example, the pattern is just repeated, and the only difference is the suffix of the: million, thousand, and nothing (an empty string).