Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

//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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Lab Manual For Database Development

Authors: Rachelle Reese

1st Custom Edition

1256741736, 978-1256741732

More Books

Students also viewed these Databases questions