Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ClassDogger
- {
- abstract class Dog : IComparable
- {
- #region Variables
- protected string name;
- protected int age;
- protected double length;
- protected double withers;
- protected double weight;
- protected bool sex;
- public abstract double tail();
- #endregion
- #region SetAndGet
- public string Name
- {
- get
- {
- return name;
- }
- set
- {
- name = value;
- }
- }
- public int Age
- {
- get
- {
- return age;
- }
- set
- {
- age = value;
- }
- }
- public double Length
- {
- get
- {
- return length;
- }
- set
- {
- length = value;
- }
- }
- public double Withers
- {
- get
- {
- return withers;
- }
- set
- {
- withers = value;
- }
- }
- public double Weight
- {
- get
- {
- return weight;
- }
- set
- {
- weight = value;
- }
- }
- public bool Sex
- {
- get
- {
- return sex;
- }
- set
- {
- sex = value;
- }
- }
- #endregion
- public Dog(string name, int age, double length, double withers, double weight, bool sex)
- {
- Name = name;
- Age = age;
- Length = length;
- Withers = withers;
- Weight = weight;
- Sex = sex;
- }
- #region PrintAll
- public void PrintAll()
- {
- Console.WriteLine("Name: " + name + ", Breed: " + GetType().Name + ", Sex: " + (sex ? "Male" : "Female") + ", Age: " + age + " year(s), Length: " + length + "cm, Withers: " + withers + "cm, Weight: " + weight + "kg, tail length: " + tail() + "cm");
- }
- #endregion
- #region EditAll
- public void EditAll(string name, int age, double length, double withers, double weigth, bool sex)
- {
- Name = name;
- Age = age;
- Length = length;
- Withers = withers;
- Weight = weight;
- Sex = sex;
- }
- #endregion
- public int CompareTo(object obj)
- {
- Dog dog = obj as Dog;
- return String.Compare(Name, dog.Name);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement