Advertisement
wingman007

ExerciseClassTree

Mar 20th, 2017
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.88 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Exercise2a
  8. {
  9.     class Tree
  10.     {
  11.         public string Type { get; set; }
  12.         public double Diameter { get; set; }
  13.         public static string Color { get; set; }
  14.         public static int Counter { get; private set; }
  15.  
  16.         public Tree()
  17.             :this("Default", 0.0)
  18.         {
  19.  
  20.         }
  21.  
  22.         public Tree(string type, double diameter)
  23.         {
  24.             Type = type;
  25.             Diameter = diameter;
  26.             Counter++;
  27.         }
  28.  
  29.         public Tree(double diameter, string type)
  30.             :this(type, diameter)
  31.         {
  32.  
  33.         }
  34.  
  35.         public override string ToString()
  36.         {
  37.             return String.Format("Type = {0}, Diamater = {1}, Color = {2}", Type, Diameter, Color);
  38.         }
  39.  
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement