Professional Documents
Culture Documents
Animal Code
Animal Code
namespace Assignment2
{
class animals
{
static void Main(string[] args)
{
// string aname;
Console.WriteLine("------------------Pet Simulator---------------");
Console.WriteLine("----------------------------------------------");
Console.WriteLine();
Console.WriteLine("What is your name? ");
string aname = Console.ReadLine();
Console.WriteLine("||||||||||||||||||||||||||||||||||||||||||||||");
Console.WriteLine("\t\tWELCOME {0}", aname);
Console.WriteLine("||||||||||||||||||||||||||||||||||||||||||||||");
Console.WriteLine("||||||||||||||||||||||||||||||||||||||||||||||");
Console.WriteLine("Please Choose Between [(A)CAT__(B)MOUSE]");
string chonum = Convert.ToString(Console.ReadLine());
if(chonum == "a" || chonum == "A")
{
Console.WriteLine("----------------------------------------------");
Console.WriteLine("What is the name of the cat?");
Console.WriteLine("----------------------------------------------");
cat.Name = Console.ReadLine();
Boolean catback = false;
while( catback == false )
{
Console.WriteLine("What would you like to do with the cat?");
Console.WriteLine("(1)DRINK (2)EAT (3)PLAY");
Console.WriteLine("----------------------------------------------");
int num = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
if(num == 1)
{
Console.WriteLine("Youre giving water!!!");
cat.drink();
}
else if(num == 2)
{
Console.WriteLine("Youre giving food!!!");
cat.eat();
}
else if( num == 3)
{
cat.run();
Console.WriteLine("After some time");
cat.back();
cat.getvelocity();
}
Console.WriteLine("Do you want to choose again?(Y/N)");
string yn = Convert.ToString(Console.ReadLine());
if(yn == "y" || yn == "Y")
{
}
else
{
catback = true;
Console.WriteLine("Thank you for playing");
}
}
}
else if (chonum == "b" || chonum == "B")
{
Boolean moback = false;
while(moback == false)
{
Console.WriteLine("What would you like to do with the Mouse?");
Console.WriteLine("(1)DRINK (2)EAT (3)PLAY");
int num2 = Convert.ToInt32(Console.ReadLine());
if (num2 == 1)
{
Console.WriteLine("Youre giving water!!!");
mouse.drink();
}
else if (num2 == 2)
{
Console.WriteLine("Youre giving food!!!");
mouse.eat();
}
else if (num2 == 3)
{
mouse.run();
Console.WriteLine("----------------------------------------------");
Console.WriteLine("After some time");
mouse.back();
mouse.getvelocity();
}
Console.WriteLine("Do you want to choose again?(Y/N)");
string ynask = Convert.ToString(Console.ReadLine());
if (ynask == "y" || ynask == "Y")
{
}
else
{
moback = true;
Console.WriteLine("Thank you for playing");
}
}
}
}
}
interface Icanmove
{
void run();
void back();
void getvelocity();
}
interface Icaneat
{
void eat();
}
interface Icandrink
{
void drink();
}
public Cat(string name)
{
Name = name;
}
// public void Ask()
// {
// Console.WriteLine("What is the name of the cat? {0}", Name);
// Console.WriteLine("=================================");
// Console.WriteLine("The name of the cat is {0} ",Name);
// }
Console.WriteLine("----------------------------------------------");
Console.WriteLine("\tWith a speed of {0} m/s", rnd2.Next(10));
Console.WriteLine("----------------------------------------------");
}
}
Console.WriteLine("----------------------------------------------");
Console.WriteLine("\tWith a speed of {0} m/s", rnd2.Next(10));
Console.WriteLine("----------------------------------------------");
}
}
}
}