שפת C: הבדלים בין גרסאות בדף
תוכן שנמחק תוכן שנוסף
אין תקציר עריכה |
אין תקציר עריכה |
||
שורה 1:
private string name; // Name of song
private string performer; // Song performer
private int length; // song length in seconds
public Song(string name, string performer, int length)
{
this.performer = performer;
this.length = length;
}
public Song(Song song1)
{
this.name = song1.GetName();
this.performer = song1.GetPerformer();
this.length = song1.GetLength();
}
public
{
return this.performer;
return this.length;
▲ return this.n2;
{
}▼
this.name = name;
▲ public override string ToString()
public void SetPerformer(string performer)
{
}▼
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;
▲ }
|