namespace JOPPESHUNDAR
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void MenuButtonExitProgram_Click(object sender, EventArgs e)
{
}
public class Petowner : Form1
{
private int age { get; set; }
private int name { get; set; }
public List<Animal> Animal_List = new List<Animal>();
public Petowner(int age)
{
Age = age;
Animal_List.Add(new Cat("Misse", 4, "fish"));
Animal_List.Add(new Dog("Zorro", 5, "meat"));
Animal_List.Add(new Puppy("Zeus", 3, "candy"));
}
public void AddPet()
{
}
public int Age
{
get { return age; }
set { age = value; }
}
public void MenuButtonListAnimals_Click(object sender, EventArgs e)
{
textBox1.Text = "Here is the animals: \r\n";
foreach (Animal animales in Animal_List)
{
textBox1.Text = ("\r\n" + animales);
}
}
public void MenuButtonPlayWanimals_Click(object sender, EventArgs e)
{
textBox1.Text = "Here is the animals: \r\n";
foreach (Animal animales in Animal_List)
{
textBox1.Text =("\r\n" + animales);
}
textBox1.Text = "Which animal do you want to play with?";
}
public void MenuButtonFeedAnimals_Click(object sender, EventArgs e)
{
foreach (Animal animales in Animal_List)
{
textBox1.Text = ("\r\n" + animales);
}
textBox1.Text = "Which animal do you want to feed?";
}
}
public abstract class Animal
{
protected int age { get; set; }
protected string name { get; set; }
protected string fav_food { get; set; }
protected string breed { get; set; }
protected bool hungry { get; set; }
public Animal(string name, int age, string fav_food)
{
}
public virtual void Interact()
{
}
public virtual void Eat()
{
}
public virtual void Hungry_Animal()
{
}
public override string ToString()
{
return base.ToString();
}
}
public class Cat : Animal
{
public Cat(string name, int age, string fav_food) : base(name, age, fav_food)
{
Name = name;
Age = age;
Fav_Food = fav_food;
}
public string Name
{
get { return name; }
set { name = value; }
}
public int Age
{
get { return age; }
set { age = value; }
}
public override void Interact()
{
Random rdmr = new Random();
int interact = rdmr.Next(0, 2);
if (interact == 0)
{
Console.Write("\nJoppe is playing with {0}", Name);
}
if (interact == 1)
{
Console.Write("\n{0} is too hungry to play. . .", Name);
}
}
public override void Hungry_Animal()
{
}
public override void Eat()
{
Console.Write("\nWhat do you want to feed {0} with?\n", Name);
Console.Write("\n1. Fish");
Console.Write("\n2. Chicken");
Console.Write("\n\nYour choice: ");
int anwser = int.Parse(Console.ReadLine());
{
if (anwser == 1)
{
Console.Write("\nNomnom, {0} is full after eating her favourite food {1}", Name, fav_food);
}
if (anwser == 2)
{
Console.Write("\nUrrgh, {0} doesn't like Chicken!! Misse will now go out to find food!\n", Name);
Random rdmr = new Random();
int mousechans = rdmr.Next(0, 2);
if (mousechans == 0)
{
Console.Write("\n{0} found a mouse, she is now full!", Name);
}
if (mousechans == 1)
{
Console.Write("\n{0} did not find a mouse and she is still hungry. . .", Name);
}
}
}
}
public string Fav_Food
{
get { return fav_food; }
set { fav_food = value; }
}
public override string ToString()
{
return string.Format("1. {0}", Name);
}
}
public class Dog : Animal
{
public Dog(string name, int age, string fav_food) : base(name, age, fav_food)
{
Name = name;
Age = age;
}
public string Name
{
get { return name; }
set { name = value; }
}
public int Age
{
get { return age; }
set { age = value; }
}
public override void Interact()
{
Random rdmr = new Random();
int interact = rdmr.Next(0, 2);
if (interact == 0)
{
Console.Write("\nJoppe is playing with {0}", Name);
}
if (interact == 1)
{
Console.Write("\n{0} is too hungry to play. . .", Name);
}
}
public override void Eat()
{
Console.Write("\nWhat do you want to feed {0} with?\n", Name);
Console.Write("\n1. Meat");
Console.Write("\n2. Fish");
Console.Write("\n\nYour choice: ");
int anwser = int.Parse(Console.ReadLine());
{
if (anwser == 1)
{
Console.Write("\nNomnom, {0} is full after eating his favourite food {1}", Name, fav_food);
}
if (anwser == 2)
{
Console.Write("\nUrrgh, {0} doesn't like fish!!", Name);
}
}
}
public string Fav_Food
{
get { return fav_food; }
set { fav_food = value; }
}
public override string ToString()
{
return string.Format("2. {0}", Name);
}
}
public class Puppy : Dog
{
public Puppy(string name, int age, string fav_food) : base("", 0, fav_food)
{
Name = name;
Age = age;
}
public override void Interact()
{
Random rdmr = new Random();
int interact = rdmr.Next(0, 2);
if (interact == 0)
{
Console.Write("\nJoppe is playing with {0}", Name);
}
if (interact == 1)
{
Console.Write("\n{0} is too hungry to play. . .", Name);
}
}
public override void Eat()
{
Console.Write("\nWhat do you want to feed {0} with?\n", Name);
Console.Write("\n1. Candy");
Console.Write("\n2. Meat");
Console.Write("\n\nYour choice: ");
int anwser = int.Parse(Console.ReadLine());
{
if (anwser == 1)
{
Console.Write("\nNomnom, {0} is full after eating his favourite food {1}.", Name, Fav_Food);
}
if (anwser == 2)
{
Console.Write("\nUrrgh, {0} doesn't like fish!!", Name);
}
}
}
public new string Fav_Food
{
get { return fav_food; }
set { fav_food = value; }
}
public override string ToString()
{
return string.Format("3. {0}", Name);
}
}
}
}