<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
/**
 * @Author: <NAME>
 * @StudentNumber: 300847239
 * @DateCreated: June, 06,2016
 * @DateReleased: June, 17,2016
 * @Description: This program tests the GiantPlanet and TerrestrialPlanet classes.
 * Version #: 0.0.3
 */
namespace Assignment3
{
    public class Program
    {
        /// <summary>
        /// Main Method
        /// </summary>
        /// <param name="args"></param>
        public static void Main(string[] args)
        {

            #region GiantPlanet
            Console.BackgroundColor = ConsoleColor.Blue;
            Console.ForegroundColor = ConsoleColor.White;
            Planet Saturn = new GiantPlanet("Saturn", 95.5, 92.5, "Gas");
            Console.WriteLine("************************************************");
            Console.WriteLine(Saturn.ToString());
            Console.WriteLine("************************************************");
            #endregion

            Console.WriteLine();
            Console.BackgroundColor = ConsoleColor.Red;

            #region TerrestrialPlanet
            
            TerrestrialPlanet Nebula = new TerrestrialPlanet("Nebula", 70.2, 80.3, true);
            Console.WriteLine("************************************************");
            Console.WriteLine(Nebula.ToString());
            Console.WriteLine("************************************************");
            
            #endregion

            Console.WriteLine();
            
            waitForAnyKey();
   
        }
        /// <summary>
        /// Utility method to wait for a console key press from the user.
        /// </summary>
        /// @Returns Void
        /// @Method WaitForAnyKey()
        public static void waitForAnyKey()
        {
            /*Console.WriteLine("enter 'x' to exit: ");
            Console.WriteLine("Hassan Kobeissi - 300847239");
            Console.WriteLine("S - To choose Saturn");
            Console.WriteLine("G - To choose Giant Planet");
            string choice = Console.ReadLine();
           /* switch (choice)
            {
               
                case "x":
                    break;
              
            }*/
            Console.WriteLine("Press Any Key to exit: ");
            Console.ReadKey();
        }
    }
}
<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
/**
 * @Author: <NAME>
 * @StudentNumber: 300847239
 * @Date Created: June, 06,2016
 * @Datee Released: June/17/2016
 * @Document Description: Returns a bool data type
 * Version #: 0.0.3
 */
namespace Assignment3
{
    public interface IHabitable
    {
        ///<summary>abstract method - force children to implement this method</summary>
        bool Habitable();
    }
}<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
/**
 * @Author: <NAME>
 * @StudentNumber: 300847239
 * @Date Created: June, 06,2016
 * @DateReleased: June, 17,2016
 * @DocumentDescription: Subclass of Planet Abstract class. Also Implements interfaces.
 * Version #: 0.0.3
 */
namespace Assignment3
{
    public class TerrestrialPlanet : Planet, IHasMoons, IHabitable
    {
        #region Private Instance Variable _oxygen
        /// <summary>
        /// Private Instance Variable _oxygen
        /// </summary>
        private bool _oxygen;
        #endregion

        #region Constructor
        /// <summary>
        /// TerrestrialPlanet Constructor Method
        /// </summary>
        public TerrestrialPlanet(string name, double diameter, double mass, bool oxygen)
            :base(name,diameter,mass)
        {
            this.Oxygen = oxygen;

        }
        #endregion

        #region Public Methods
        /// <summary>
        /// A public property Oxygen
        /// </summary>
        public bool Oxygen
        {
            get
            {
                return _oxygen;
            }

            set
            {
                _oxygen = value;
            }
        }
        /// <summary>
        /// Implementation of the Habitable() method to return true Depending if it's Habitable
        public bool Habitable()
        {
            if (Oxygen == true)
            {
                return true;
            }
            else
                return false;
        }
        /// <summary>
        /// Implementation of the HasMoons() method to return true Depending on it's Moons
        /// </summary>
        public bool HasMoons()
        {
            if (MoonCount > 0)
            {
                return true;
            }
            return false;
        }
        #endregion

        #region ToString()
        /// <summary>
        /// ToString() Override the inherited ToString() method so that it outputs Oxygen.
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return base.ToString() + String.Format("\n{0} Has Oxygen? {1}",this.Name, Oxygen);
        }
        #endregion
    }
}<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
/**
 * @Author: <NAME>
 * @StudentNumber: 300847239
 * @DateCreated: June, 06,2016
 * @DateRelease: June, 17,2016
 * @Description: The Parent Class, Abstract Class Planet. Root of Assignment3.
 * Version #: 0.0.3
 */
namespace Assignment3
{
    public abstract class Planet
    {
        #region Private Instance Variables
        /*PRIVATE INSTANCE VARIABLES*/
        private double _diameter;
        private double _mass;
        private int _moonCount;
        private string _name;
        private double _orbitalPeriod;
        private int _ringCount;
        private double _rotationPeriod;
        #endregion

        #region public Planet 
        /// <summary>
        /// Planet Constructor Method
        /// </summary>
        /// <param name="name"></param>
        /// <param name="diameter"></param>
        /// <param name="mass"></param>
        public Planet(string name, double diameter, double mass)
       {
            this._name = name;
            this._diameter = diameter;
            this._mass = mass;
       }
        #endregion

        #region Public Properties
        /*PUBLIC PROPERTIES*/
        public double Diameter
        {
            get
            {
                return _diameter;
            }

        }

        public double Mass
        {
            get
            {
                return _mass;
            }
        }

        public int MoonCount
        {
            get
            {
                return _moonCount;
            }
            set
            {
                _moonCount = value;
            }

        }

        public string Name
        {
            get
            {
                return _name;
            }
        }

        public double OrbitalPeriod
        {
            get
            {
                return _orbitalPeriod;
            }

            set
            {
                _orbitalPeriod = value;
            }
        }

        public int RingCount
        {
            get
            {
                return _ringCount;
            }

            set
            {
                _ringCount = value;
            }
        }

        public double RotationPeriod
        {
            get
            {
                return _rotationPeriod;
            }

            set
            {
                _rotationPeriod = value;
            }
        }
        #endregion

        #region ToString()
        /// <summary>
        /// Override the inherited ToString() method so	that it outputs	Name, Diameter and Mass to the Console.
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return String.Format("Name of Planet: {0}\nDiameter of {1}: {2}\nMass of {3}: {4}", this.Name, this.Name, this.Diameter, this.Name,this.Mass);

        }
        #endregion
    }
}<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
/**
 * @Author: <NAME>
 * @StudentNumber: 300847239
 * @Date Created: June, 06,2016
 * @Datee Released: June/17/2016
 * @Description: GiantPlanet sub class of Planet class. Implements IHasmoons and IHasRings interfaces
 * Version #: 0.0.3
 */
namespace Assignment3
{
    public class GiantPlanet : Planet, IHasMoons, IHasRings
    {
    
        /// <summary>
        /// Private Instance Variable  - Gas or Ice
        /// </summary>
        private string _type;

        #region Public Properties
        //Public Properties
        public string Type
        {
            get
            {
                return _type;
            }

            set
            {
                _type = value;
            }
        }
        /// <summary>
        /// Implementation of the HasMoons() method to return true Depending on it's Moons
        /// </summary>
        public bool HasMoons()
        {
            if(MoonCount > 0)
             {
                 return true;
             }
            return false;
        }
        /// <summary>
        /// Implementation of the HasRings() method to return true Depending on it's Rings
        /// </summary>
        public bool HasRings()
        {
            if(RingCount > 0)
            {
                return true;
            }
            return false;
        }
        #endregion

        #region Constructor
        /// <summary>
        /// This is the GiantPlanet Class Constructor
        /// </summary>
        /// <param name="name"></param>
        /// <param name="diameter"></param>
        /// <param name="mass"></param>
        /// <param name="type"></param>
        public GiantPlanet(string name, double diameter, double mass, string type):base(name,diameter,mass)
        {
            this.Type = type;

        }
        #endregion

        #region ToString()
        /// <summary>
        /// ToString() Override the inherited ToString() method so that it outputs Type.
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return base.ToString()  + String.Format("\n{0} is of Type: {1}",this.Name,Type);
        }
        #endregion
    }
}