kindly help me make a java program that will output 6 pets according to their type. It will first ask the user to enter the type of pet."c" or "d". if the user enters "c" , it will ask the user to enter name for the "cat", else will ask the user to enter name for dog. then output first all cats name, then followed by the list of all dogs name.
char ch; int cointforcat=0; String namecat[]=new String[100]; int cointfordog=0; String namedog[]=new String[100]; for(;;){ System.out.print("Please enter 'c' or 'd': "); ch=input.nextLine().charAt(0); if(ch=='c'){ System.out.println("Enter name for cat: "); namecat[cointforcat]=input.nextLine(); cointforcat++; } if(ch=='d'){ System.out.println("Enter name for dog: "); namedog[cointfordog]=input.nextLine(); cointfordog++; }
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment