public static void Main(string[] args) { Dog spotty = new Dog(); spotty.name = "Spotty"; spotty.age = 4; spotty.happiness = 0.8f; spotty.spotCount = 25; spotty.PrintBase(); spotty.Bark(); Console.WriteLine("New Happiness: " + spotty.happiness); Console.WriteLine(); Cat heisenberg = new Cat(); heisenberg.name = "Heisenberg"; heisenberg.age = 14; heisenberg.happiness = 0.3f; heisenberg.cuteness = 0.4f; heisenberg.PrintBase(); heisenberg.Meow(); Console.ReadKey(); }
static void Main(string[] args) { Dog dog = new Dog(); dog.Eat(); dog.Bark(); Cat cat = new Cat(); cat.Eat(); cat.Meow(); }
private void btnCreate_Click(object sender, EventArgs e) { if (radDog.Checked == true) { Dog doggo1 = new Dog(); doggo1.name = Interaction.InputBox("Enter your dog's name"); doggo1.color = Interaction.InputBox("Enter your dog's color"); doggo1.weight = Convert.ToDouble(Interaction.InputBox("Enter your dog's weight")); lblOutput.Text = doggo1.ToString(); doggo1.Bark(); } else if (radCat.Checked == true) { Cat cato1 = new Cat(); cato1.name = Interaction.InputBox("Enter your cat's name"); cato1.color = Interaction.InputBox("Enter your cat's color"); cato1.weight = Convert.ToDouble(Interaction.InputBox("Enter your cat's weight")); lblOutput.Text = cato1.ToString(); cato1.Meow(); } else if (radBird.Checked == true) { Bird birb1 = new Bird(); birb1.name = Interaction.InputBox("Enter your bird's name"); birb1.color = Interaction.InputBox("Enter your bird's color"); birb1.weight = Convert.ToDouble(Interaction.InputBox("Enter your bird's weight")); lblOutput.Text = birb1.ToString(); birb1.Tweet(); } }