Please separate this code to two class... main class and another classmain class will only run the code and
the other class will have the body of the cod or the methods and other...
thank you
package Test;
import java.util.Scanner;public class NumbersInWords { public static void main(String[] args) { Scanner myObj = new Scanner(System.in); // Create a Scanner object System.out.println("Enter Number 0 to 999,999,999:-"); String number = myObj.nextLine(); // Read user input int number1 = number.length(); String numberToWord = ""; for (int j = 0; j < number1;="" j++)=""> switch (number.charAt(j)) { case '1': { numberToWord = numberToWord + "one "; break; } case '2': { numberToWord = numberToWord + "two "; break; } case '3': { numberToWord = numberToWord + "three "; break; } case '4': { numberToWord = numberToWord + "four "; break; } case '5': { numberToWord = numberToWord + "five "; break; } case '6': { numberToWord = numberToWord + "six "; break; } case '7': { numberToWord = numberToWord + "seven "; break; } case '8': { numberToWord = numberToWord + "eight "; break; } case '9': { numberToWord = numberToWord + "nine "; break; } default: { numberToWord = numberToWord + "zero "; } } } System.out.println(numberToWord); }}
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here