Join Regular Classroom : Visit ClassroomTech

Epam Questions Solve | Round 4 | Codewindow.in

Question: Owner of a shop and a smart kiddo

Raj went to a shop to buy some chocolates along with his daughter. Raj picks one chocolate and ask the shop owner Durga to tell the price of that chocolate. So Durga says it as Integer 123. Then the kiddo who is along with Raj start saying to her dad that-“the amount to be paid is “One Hundred Twenty Three” in English words.

Assume shop owner givers a non-negetive integer price every time kiddo picks a new item in te shop. Write a program to help Raj to convert the integer to its English words representation. Given input is guaranteed to be less than 2^31-1.

Example 1:

Input: 321
Output: “Three Hundred Twenty One”

Example 2:

Input: 7654321
Output: “Seven Million Six Hundred Fifty Four Thousand Three Hundred Twenty One”

import java.util.Scanner;

class Conversion {
	public String numberToWords(int num) {

	//Write your Code here
	//Main method is hidden don't write it again
	}
}

</showDefaultCode>
public class Main{
	public static void main(String[] args)
		Scanner scanner = new Scanner(System.in);
		int number = scanner.nextInt();
		System.out.println(new Conversion().numberToWords(number));
	}
}
You Missed
Also Checkout