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.Web;
- namespace LB4_V2
- {
- /// <summary>
- /// Data Class using Publication as its abstract class
- /// </summary>
- public class Journal : Publication, IComparable<Journal>, IEquatable<Journal>
- {
- public string ISBN { get; set; }
- public int number { get; set; }
- public int monthOfRelease { get; set; }
- /// <summary>
- /// Constructor for Journal class
- /// </summary>
- /// <param name="name"></param>
- /// <param name="type"></param>
- /// <param name="publishingPlace"></param>
- /// <param name="yearOfRelease"></param>
- /// <param name="numberOfPages"></param>
- /// <param name="edition"></param>
- /// <param name="iSBN"></param>
- /// <param name="number"></param>
- /// <param name="monthOfRelease"></param>
- public Journal(string name, string type, string publishingPlace, int yearOfRelease, int numberOfPages, int edition,
- string iSBN, int number, int monthOfRelease) : base(name, type, publishingPlace, yearOfRelease, numberOfPages, edition)
- {
- ISBN = iSBN;
- this.number = number;
- this.monthOfRelease = monthOfRelease;
- }
- /// <summary>
- /// Implemented IComparable<Journal> interface
- /// </summary>
- /// <param name="other"></param>
- /// <returns></returns>
- public int CompareTo(Journal other)
- {
- if (this.yearOfRelease.CompareTo(other.yearOfRelease) != 0)
- {
- return this.yearOfRelease.CompareTo(other.yearOfRelease);
- }
- else
- {
- return this.monthOfRelease.CompareTo(other.monthOfRelease);
- }
- }
- /// <summary>
- /// Implemented IEquatable<Journal> interface
- /// </summary>
- /// <param name="other"></param>
- /// <returns></returns>
- public bool Equals(Journal other)
- {
- if (this.ISBN.Equals(other.ISBN) && this.number == other.number && this.monthOfRelease == other.monthOfRelease)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- /// <summary>
- /// Overridden ToString() method
- /// </summary>
- /// <returns></returns>
- public override string ToString()
- {
- return String.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8}", this.name, this.type, this.publishingPlace, this.yearOfRelease,
- this.numberOfPages, this.edition, this.ISBN, this.number, this.monthOfRelease);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement