שפת C: הבדלים בין גרסאות בדף

תוכן שנמחק תוכן שנוסף
אין תקציר עריכה
אין תקציר עריכה
שורה 1:
private string name; // Name of song
private int n1;
private string performer; // Song performer
private int n2;
private int length; // song length in seconds
public Song(string name, string performer, int length)
{
return this.n2name = name;
this.performer = performer;
this.length = length;
}
public Song(Song song1)
{
this.name = song1.GetName();
this.performer = song1.GetPerformer();
this.length = song1.GetLength();
}
 
public Dominostring GetName()
{
Random r = new Random() return this.name;
this.n1 = r.Next(1, 7); }
this.n2 = r.Next(1, 7 public string GetPerformer();
} {
return this.performer;
public int GetN1()
{ }
return this.n1; public int GetLength()
} {
return this.length;
public int GetN2()
{ }
public overridevoid SetName(string ToString(name)
return this.n2;
{
}
this.name = name;
public override string ToString()
{ }
public void SetPerformer(string performer)
return "N1: " + this.n1 + " N2: " + this.n2;
{
}
this.performer = performer;
}
public void SetLength(int length)
{
this.length = length;
}
 
public void IncreaseLength(int sec)
{
this.length += sec;
}
public void DecreaseLength(int sec)
{
this.length -= sec;
}
public string Category()
{
if (this.length< 120)
return "short";
if (this.length > 240)
return "long";
return "average";
}
public string ToString()
{
return "The song name is: " +this.name+" the preformer is: " + this.performer+ " the song length in seconds is: " + length;
}