My dog can do tricks For this lab we once again are going to create 2 classes, 1 called Dog and 1 called Lab10B. Dog objects have a few attributes, but this time unlike chair objects they can also do some cool things to. Each action is represented by a method. Therefore, for any action our Dog can do or we do to the Dog, we are going to create a method. For example, if I want my Dog to bark, I can create a method to do that in the Dog class and call that method in the driver Lab10B once I have create an object. Dog class: • Variables (Attributes): - make these public, like the first exercise o int age //current age of the dog o double weight //how much does it weight in lbs o String/string name //what is the name of the dog o String/string furColor //color of the dog’s fur/hair o String/string breed //what breed is the dog • Behaviors (Methods): - these also should be public o bark //prints "Woof! Woof!" o rename //take a string and change the name of the dog o eat //take a double and add that number to weight Keep in mind you need to have a return data type for each method and what parameters these take to carry out their function when creating the methods. Driver class: This class will have our typical main method. Inside of this method, create a new Dog object and prompt the user to input the attributes describing this Dog. Once done, print out all the details about the Dog. Next, use the methods you created in the Dog class to have it bark, change the name (using the rename method not the dot operator), and feed it. Finally print out all the details about the Dog, the object should have changed because of your calls to the various methods. Sample output: You are about to create a dog. How old is the dog: 5 How much does the dog weigh: 30.5 What is the dog’s name: Patches What color is the dog: chocolate What breed is the dog: lab Patches is a 5 year old chocolate lab that weighs 30.5 lbs. Woof! Woof! Patches is hungry, how much should he eat: 5000.3 Patches isn’t a very good name. What should they be renamed to: Sparky Sparky is a 5 year old chocolate lab that weighs 5030.8 lbs.

Respuesta :

Dog can do tricks For this lab we once again are going to create 2 classes, 1 called Dog and 1 called Lab10B. And the function is given below.

What is function?

A function is a logical, reusable section of code that executes a single, connected action. In addition to a high level of code reuse, functions improve the modularity of your application.

You have already encountered a number of functions, including printf() and main ().

These are referred to as built-in functions that the language itself offers, but we can also create our own functions. This tutorial will show you how to do both in the C programming language.

//C# Code

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;  

namespace lab10b{

    class Dog

    {

        public int age;

        public double weight;

        public string name;

        public string furColor;

        public string breed;

         public void bark()        

{  

          Console.WriteLine("Woof! Woof!");      

   }        

public void rename(string name)    

    {             this.name = name;  

     }        

 public void eat(double food)      

 {             weight += food;    

    }    

 }    

class Lab10B    

{         static void Main(string[] args)  

     {             Dog dog = new Dog();

          Console.WriteLine("You are about to create a dog.");

            Console.Write("How old is the dog:: ");

            dog.age = int.Parse(Console.ReadLine());

            Console.Write("How much does the dog weigh: ");

            dog.weight = double.Parse(Console.ReadLine());

                  Console.Write("What is the dog’s name:: ");

            dog.name = Console.ReadLine();

            Console.Write("What color is the dog: ");

            dog.furColor = Console.ReadLine();

            Console.Write("What breed is the dog: ");

            dog.breed = Console.ReadLine();

               // print out all the details about the Dog    

        Console.WriteLine("{0} is a {1} year old {2} {3} that weighs {4} lbs.",                 dog.name,dog.age,dog.furColor,dog.breed,dog.weight);      

     dog.bark();          

  Console.Write("Patches is hungry, how much should he eat: ");          

 dog.eat(double.Parse(Console.ReadLine()));        

   Console.Write("Patches isn’t a very good name. What should they be renamed to: ");      

     dog.rename(Console.ReadLine());        

   Console.WriteLine("{0} is a {1} year old {2} {3} that weighs {4} lbs.",                dog.name, dog.age, dog.furColor, dog.breed, dog.weight);    

    }    

}

}

Learn more about function

https://brainly.com/question/20476366

#SPJ4