Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.97 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace AquariumAdventure
  6. {
  7.     public class Fish
  8.     {
  9.         private string name;
  10.         private string color;
  11.         private int fins;
  12.  
  13.         public Fish(string name, string color, int fins)
  14.         {
  15.             Name = name;
  16.             Color = color;
  17.             Fins = fins;
  18.         }
  19.  
  20.         public string Name
  21.         {
  22.             get { return name; }
  23.             set { name = value; }
  24.         }
  25.    
  26.         public string Color
  27.         {
  28.             get { return color; }
  29.             set { color = value; }
  30.         }
  31.        
  32.         public int Fins
  33.         {
  34.             get { return fins; }
  35.             set { fins = value; }
  36.         }
  37.  
  38.         public override string ToString()
  39.         {
  40.             string output = $"Fish: {Name}{Environment.NewLine}Color: {Color}{Environment.NewLine}Number of fins: {Fins}";
  41.  
  42.             return output;
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement