Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Challenge: Dog Description: Create a Dog class that contains specified properties and methods. Create an instance of Dog and use its methods. Purpose: This application

Challenge: Dog

Description: Create a Dog class that contains specified properties and methods. Create an instance of Dog and use its methods.

Purpose: This application provides experience with creating classes and instances of objects in C#.

Requirements:

Project Name: Dog Target Platform: Console Programming Language: C#

This project is to be managed in a public GitHub repository. For this challenge, submit the Clone with HTTPS URL for the GitHub repository that contains it.

image text in transcribed

Create a class called Dog Dog is to have the following public properties: nome (of type string) owner of type string) age (of type int) gender (of type Gender) Gender is a enum type you need to create that contains Male and Female, Create a constructore in the class to initialize all of the properties when creating an instance, Create a method (function in the class) called Bark that takes one parameter that is the number of times to bark and prints "Woof!" that many times to the Console. Create a method called GetTag that takes no parameters and returns a string. The method returns "If lost, call (owner). ('Her'|'His' name is (name) and('she''he') is (age] [year'l'years'] old." (owner) means replace with the name of the owner. ['Her'l'His'] means choose to display "Her" or "His based on the gender of the Dog. [name] means replace with the name of the Dog. ['she'l'he'l means choose to display "she" or "he" based on the gender of the Dog, [year'|'years'] means to choose to display "year" or "years" depending on the age of the Dog. If age is 1, use "year". If any other age ,use "years". In the Main function of the application, test that instances of Dog can be created and that the methods work. In the following, "Orion" is the name of the Dog instance, "Shawn is the owner , 1 is the age, and Gender. Male is the gender Dog puppy - Dog("Orion", "Shawn", 1, Gender Male); // create object instance puppy-Bark(3); // output: Woof!Woof!Woof! Console.WriteLine(puppy.Get Togo); // output: If lost, call Shawn. His name is Orion and he is 1 year old. Dog myDog - Dog("Lileu", "Dale", 4, Gender. Female); // create object instance MyDog Bark(1); // output: Woof! Console.WriteLine(myDog. GetTago); // output: If lost, call Dale. Her name is Lileu and she is 4 years old. Submission

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

Object Oriented Databases Prentice Hall International Series In Computer Science

Authors: John G. Hughes

1st Edition

0136298745, 978-0136298748

More Books

Students also viewed these Databases questions

Question

Determine miller indices of plane A Z a/2 X a/2 a/2 Y

Answered: 1 week ago