I am trying to put create the getscoops class within the icecreamcone class. I need to reference two different classes to the icecreamcone class. I am able to get both codes to work seperately but can't seem to figure out how to put both classes in one class. Could anyone give me a example of how I would accomplish this task.
CODE
using System;
public class icecreamconedemo
{
public static void Main()
{
getscoops = sp = new getscoops();
bool isScoopsGood = false;
while(!isScoopsGood)
{
try
{
sp.promptgetscoops();
isScoopsGood = true;
}
catch (Exception f)
{
Console.WriteLine(f.Message);
}
}
}
}
public class icecreamcone
{
public class getscoops
{
private int numberScoops;
public void promptgetscoops()
{
string strScoops;
try
{
Console.WriteLine("Enter the number of scoops for your cone?");
strScoops = Console.ReadLine();
numberScoops = Convert.ToInt32(strScoops);
if(numberScoops >= 3)
{
icecreamconeException nbe = new
icecreamconeException();
throw(nbe);
}
else
{
Console.WriteLine("Enjoy your icecream.");
}
}
catch(Exception f)
{
throw(f);
}
}
}
}
public class icecreamconeException : ApplicationException
{
private static string msg = "That many scoops will fall off of your cone";
public icecreamconeException() : base(msg)
{
}
}