// Sample Solution
using System;
///////////////////////////////////////////////////
// Forest.cs code
namespace BasicClasses
{
class Forest
{
public int age;
public string Name
{ get; set; }
public int Trees
{ get; set; }
private string Biome
{
get { return biome; }
set
{
if (value == "Tropical" ||
value == "Temperate" ||
value == "Boreal")
{
biome = value;
}
else
{
biome = "Unknown";
}
}
}
}
}
///////////////////////////////////////////////////
// Program.cs code
using System;
namespace BasicClasses
{
class Program
{
static void Main(string[] args)
{
Forest f = new Forest();
f.Name = "Congo";
f.Trees = 0;
f.age = 0;
f.Biome = "Desert";
Console.WriteLine(f.Name);
Console.WriteLine(f.Biome);
}
}
}
No comments:
Post a Comment