Question: //in java Ask the user for 4 different dog names, ages, and breeds, and instantiate dogs of these types and put the dogs into an

//in java

Ask the user for 4 different dog names, ages, and breeds, and instantiate dogs of these types and put the dogs into an array. Then ask the user which breed they would like to count up, then count and display how many dogs of that type are found in the array

Import Scanner, instantiate a Scanner, and instantiate an array of type Dog.

Write a loop, within which you ask the reader for dog: Name, Age, Breed. Read this data into local variables, then transfer the data into an instance of a Dog, then add the dog to the array. Write a subsequent loop that asks the user which breed to count up or type quit to exit the loop, and the program. Whichever breed is entered, use another loop to count up how many instances of that breed are in the loop and display out the result.

Example Interaction (User input in comments)

Give me a dog Name, Age, and Breed separated by spaces:

//Max golden 4

Give me a dog Name, Age, and Breed separated by spaces:

//Ashaya pitbull 9

Give me a dog Name, Age, and Breed separated by spaces:

//Zuko pitbull 7

Give me a dog Name, Age, and Breed separated by spaces:

//Nugget chihuahua 6

What breed would you like to count? (or quit to exit)

//pitbull

2 pitbulls found

What breed would you like to count? (or quit to exit)

//sheepdog

0 sheepdogs found

What breed would you like to count? (or quit to exit)

//quit

Bye

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!