LP21-Programmation-objet/TD4/Collaborateur.cs

34 lines
839 B
C#
Raw Permalink Normal View History

2022-10-06 10:41:21 +02:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Programmation_objet_TLESIO21.TD4 {
public class Collaborateur {
private readonly String NOM;
private String DateNaissance;
public Collaborateur(String nom, String birthdate) {
this.NOM = nom;
this.DateNaissance = birthdate;
}
2022-10-11 10:04:27 +02:00
public override string ToString() {
return this.NOM + " - Age " + this.GetAge() + " - Salaire " + this.GetSalaire();
}
public virtual double GetSalaire() {
2022-10-06 10:41:21 +02:00
return .0;
}
2022-10-11 10:04:27 +02:00
public String GetName() {
return this.NOM;
}
public int GetAge() {
return 2022 - Int32.Parse(this.DateNaissance.Substring(4));
}
2022-10-06 10:41:21 +02:00
}
}