static void Main(string[] args) { Inhabitant inhabitant = new Inhabitant(); Console.WriteLine("Please enter how many tigers will be at the wildlife refuge:"); int tigerAdd = Convert.ToInt32(Console.ReadLine()); int answer = inhabitant.EnclosureDetails(tigerAdd); Console.WriteLine("These tigers will need " + answer + " acres of space."); Console.ReadLine(); Console.WriteLine("Please enter how many half bags of food are available (i.e. 2.5):"); decimal bagsFood = Convert.ToDecimal(Console.ReadLine()); int bagsFood1 = Convert.ToInt32(bagsFood); int answer2 = inhabitant.EnclosureDetails(bagsFood1); Console.WriteLine(answer2 + " bags of food are needed for two tigers."); Console.ReadLine(); Console.WriteLine("Please enter the number of toys you'd like to donate to the tigers:"); string numToys = Console.ReadLine(); int answer3 = inhabitant.EnclosureDetails(inhabitant, numToys); Console.WriteLine("Thank you, we now have " + answer3 + " tiger toy(s) left over."); Console.ReadLine(); }
public int EnclosureDetails(Inhabitant inhabitant, string numToys) { string input = numToys; int numOfToys = Convert.ToInt32(input); int toysPerTiger = 2; return(numOfToys % toysPerTiger); }