fork download
  1. using System;
  2.  
  3. namespace Balloons_Pops_Game_Variant_Four
  4. {
  5. public class Player : IComparable
  6. {
  7. private string playerName;
  8. private int playerScore;
  9.  
  10. public Player()
  11. {
  12. playerName = "no name";
  13. playerScore = 0;
  14. }
  15.  
  16. public Player(string name, int score)
  17. {
  18. playerName = name;
  19. playerScore = score;
  20. }
  21.  
  22. public string Name
  23. {
  24. get { return playerName; }
  25. set { playerName = value; }
  26. }
  27.  
  28. public int Score
  29. {
  30. get { return playerScore; }
  31. set { playerScore = value; }
  32. }
  33.  
  34. public override bool Equals(object obj)
  35. {
  36. if (obj == null)
  37. {
  38. return false;
  39. }
  40. return Equals(this, obj as Player);
  41. }
  42.  
  43. public override int GetHashCode()
  44. {
  45. return this.GetHashCode();
  46. }
  47.  
  48. public int CompareTo(object obj)
  49. {
  50. if (!(obj is Player))
  51. {
  52. throw new ArgumentException(
  53. "A Player object is required for comparison.");
  54. }
  55.  
  56. Player s1 = this;
  57. Player s2 = (Player)obj;
  58. return -1 * s1.Score.CompareTo(s2.Score);
  59. }
  60.  
  61. public bool Equals(Player x, Player y)
  62. {
  63.  
  64. if ((x.Name) != (y.Name)) return false;
  65. if ((x.Score) != (y.Score)) return false;
  66. return true;
  67. }
  68.  
  69. }
  70. }
  71.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
error CS5001: Program `prog.exe' does not contain a static `Main' method suitable for an entry point
Compilation failed: 1 error(s), 0 warnings
stdout
Standard output is empty