Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C: Programming Create a Java program UsePet. Your program must have a method that takes a Pet object and a String as input and returns

image text in transcribed

C: Programming Create a Java program UsePet. Your program must have a method that takes a Pet object and a String as input and returns true if the pet has a child with the name as given by the string, and false otherwise. Your program must create the following Pet object: Fluffy, a cat, who was born in 2012. She has two children: Igor, a cat, who was born in 2013 (who has no children) and Wei, an owl (who was adopted), who was born in 2014 (who has no children). Your program should then ask for user input (using a Scanner object) for a name. Using your method from above), check if Fluffy has a child with the given name and output an appropriate message. For example, if the user input was "Goran", the output should be one of yes, Fluffy has a child named Goran. or no, Fluffy does not have a child named Goran Do not hardcode "fluffy" in the output message. It should print whatever name the Pet obiect in vour program has. Your program should work correctly no matter what Pet obiect we initially create. Do not hardcode your solution for the Fluffy pet. Do not create any UsePet objects in your program Potentially Useful Things java.util.Scanner has a next) method that returns the next String token (word) from a given scanner object

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

Practical Issues In Database Management A Refernce For The Thinking Practitioner

Authors: Fabian Pascal

1st Edition

0201485559, 978-0201485554

More Books

Students also viewed these Databases questions

Question

Distinguish between trade receivables and nontrade receivables.

Answered: 1 week ago

Question

=+ c. a company president deciding whether to open a new factory

Answered: 1 week ago