Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 . Design an abstract class called YourNamePet with the following exact fields, methods, and functionality, in this order: Field / Method Description name A

1. Design an abstract class called YourNamePet with the following exact fields, methods, and functionality, in this order:
Field/Method Description
name A private string field that holds the name of the pet (e.g. Spot, Fluffy)
type A private string field that holds the type of animal that the pet is (e.g. dog, cat, bird, fish, rabbit)
YourNamePet A constructor with 2 parameters name and type that initializes the 2 fields with the corresponding parameters values.
sound An abstract void method that output the sound the pet makes.
eat A void method that outputs Eating...
sleep A void method that outputs Sleeping...
toString A string method that returns a string with the format: NAME=name, TYPE=type where name and type are the fields values.

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_2

Step: 3

blur-text-image_3

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

Professional Android 4 Application Development

Authors: Reto Meier

3rd Edition

1118223853, 9781118223857

More Books

Students also viewed these Programming questions

Question

Why do ethical lapses occur in businesses?

Answered: 1 week ago

Question

Why arent the other shipped orders without an invoice suspicious?

Answered: 1 week ago