Home / Expert Answers / Computer Science / a-java-program-that-outputs-all-ninety-nine-stanzas-of-the-34-ninety-nine-bottles-of-beer-on-the-wal-pa279

(Solved): a java program that outputs all ninety-nine stanzas of the "Ninety-Nine Bottles of Beer on the Wall" ...



a java program that outputs all ninety-nine stanzas of the "Ninety-Nine Bottles of Beer on the Wall" song. Your program should print the number of bottles in English, not as a number with a dash where its needed. For example, Ninety-nine, Eighty-one, etc.

When it gets to zero it should not print the Take one down\Pass it around portion.

Write a method that takes an integer as a parameter and returns a String. The parameter is an integer between 0 and 99, inclusive. The return value is the English equivalent of the integer parameter. Call this method to produce the number of bottles in a loop in the main() method.

Ninety-Nine bottles of beer on the wall.
Ninety-Nine bottles of beer.
Take one down.
Pass it around.
Ninety-Eight bottles of

Ninety-Nine bottles of beer on the wall. Ninety-Nine bottles of beer. Take one down. Pass it around. Ninety-Eight bottles of beer on the wall. One bottle of beer on the wall. One bottle of beer. Take one down. Pass it around. Zero bottles of beer on the wall.


We have an Answer from Expert

View Expert Answer

Expert Answer


SOLUTION: CODE: public class Main { static void convert_to_words(char[] num) { int len = num.length; String[] single_digits = new String[] {"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"};
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe