GetHowLongToRun - AS 2017

From TRCCompSci - AQA Computer Science
Revision as of 10:19, 3 March 2017 by Admin (talk | contribs) (Created page with "==The Code== <syntaxhighlight lang=Csharp> static int GetHowLongToRun() { int Years = 0; Console.WriteLine("Welcome to the Plant Growing Simulation"); Console.Wri...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The Code

static int GetHowLongToRun()
{
    int Years = 0;
    Console.WriteLine("Welcome to the Plant Growing Simulation");
    Console.WriteLine();
    Console.WriteLine("You can step through the simulation a year at a time");
    Console.WriteLine("or run the simulation for 0 to 5 years");
    Console.WriteLine("How many years do you want the simulation to run?");
    Console.Write("Enter a number between 0 and 5, or -1 for stepping mode: ");
    Years = Convert.ToInt32(Console.ReadLine());
    return Years;
}

Explanation