Answered step by step
Verified Expert Solution
Question
1 Approved Answer
JAVA. Please I need the same output! Counting animals in a zoo All similar animals in a zoo share the same cage. For example, south
JAVA. Please I need the same output! Counting animals in a zoo All similar animals in a zoo share the same cage. For example, south china tiger and javan tiger are in the same cage, and we only want to know there are two tigers. Given an integer K, followed by K lines describing animals, count and output in alphabetical order the animals in the zoo. The input data file includes multiple cases. Each case contains a number K (0<=K<=500), followed by K lines of animals with at least one word on each line, and the last word describing the kind of animal. For example, Caspian tiger is a tiger (obviously). The input is terminated by a 0. Output: For each test case, count and output the number for each animal type in alphabetic order: animal type followed by : and the number of that type animal. Other requirements: class name: CountingAnimals.java Sample input Sample output 5 List 1: Bengal tiger bear : 2 Brown bear tiger : 3 Sun bear List 2: South China tiger penguin : 2 Bali tiger 2 King penguin Fiordland penguin 0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started