Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is very similar to my question below with one change. Ineed to in this prog

ID: 3615991 • Letter: T

Question

This is very similar to my question below with one change. Ineed to in this program, print out the numbers of bottles of juicein english. So instead of 99, it needs to be ninety-nine, thenninety-eight, etc. etc. How do I do this? Please help!!! Thank youso much! Other post: I have to create a program, with the class name JuiceSong andit has to output "99 bottles of juice in the refrigerator" andcount down to 1 bottle of juice. It has to use recursive/loopingmethod with at least one instance variable. The tricky part is that the original value of 99 must be inputby the user from a second class named JuiceSongDemo. I can choosewhatever class to be responsible for the output statement. This is in java. Thank you guys for your help!! This is very similar to my question below with one change. Ineed to in this program, print out the numbers of bottles of juicein english. So instead of 99, it needs to be ninety-nine, thenninety-eight, etc. etc. How do I do this? Please help!!! Thank youso much! Other post: I have to create a program, with the class name JuiceSong andit has to output "99 bottles of juice in the refrigerator" andcount down to 1 bottle of juice. It has to use recursive/loopingmethod with at least one instance variable. The tricky part is that the original value of 99 must be inputby the user from a second class named JuiceSongDemo. I can choosewhatever class to be responsible for the output statement. This is in java. Thank you guys for your help!!

Explanation / Answer

please rate - thanks without a switch--2 classes and recursive as requested import java.util.Scanner; public class JuiceSong { public void countdown(int n)      {int m;         m=n/10;         if(m==9)System.out.print("ninty");         else if (m==8)System.out.print("eighty");         else if (m==7)System.out.print("seventy");         else if (m==6)System.out.print("sixty");         else if (m==5)System.out.print("fifty");         else if (m==4)System.out.print("forty");         else if (m==3)System.out.print("thirty");         else if(m==2)System.out.print("twenty");         else if (m==1)               {m=n%10;                    if(m==9)System.out.print("ninteen ");                 else if(m==8) System.out.print("eighteen ");                 else if(m==7) System.out.print("seventeen ");                    else if(m==6)System.out.print("sixteen ");                    elseif(m==5)System.out.print("fifteen ");                    elseif(m==4)System.out.print("fourteen ");                    else if(m==3)System.out.print("thirteen ");                    elseif(m==2)System.out.print("twelve ");                 else if(m==1) System.out.print("eleven ");                   else System.out.print("ten ");               }          if((m==0||(m!=0&&n%10!=0))&&n/10!=1)            { m=n%10;                  if(m==9) System.out.print("-nine");              else if(m==8) System.out.print("-eight ");              else if(m==7) System.out.print("-seven ");              else if(m==6) System.out.print("-six ");              else if(m==5)System.out.print("-five ");              else if(m==4)System.out.print("-four ");              else if(m==3) System.out.print("-three ");              else if(m==2) System.out.print("-two ");              else if(m==1)System.out.print("-one ");              if(n==0)System.out.print("zero ");               }         System.out.println("bottles of juice in the refrigerator");                            if(n==0)               return;                   countdown(n-1);        }    } import java.util.Scanner; class JuiceSongDemo { public static void main(String[] args) {Scanner in=new Scanner(System.in); System.out.println("How many bottles to start with? "); int bottles =in.nextInt(); JuiceSong n = new JuiceSong(); n.countdown(bottles); } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote