All pastes #2108529 Raw Edit

Someone

public text v1 · immutable
#2108529 ·published 2012-02-01 08:22 UTC
rendered paste body


public class Personne {
	protected int num_pers;
	protected String nom, prenom;
	
	public Personne()
	{
		this.num_pers=0;
		this.nom=this.prenom="";
	}
	
	public Personne(int num, String n, String p)
	{
		this.num_pers=num;
		this.nom=n;
		this.prenom=p;
	}
	
	public void saisir()
	{
		System.out.println("Donner un numero : ");
		this.num_pers=Console.saisir_entier();
		System.out.println("Donner le nom : ");
		this.nom=Console.saisir_chaine();
		System.out.println("Donner le prenom : ");
		this.prenom=Console.saisir_chaine();
	}
	
	public void afficher()
	{
		System.out.println("Le numero 	: " + this.num_pers);
		System.out.println("Le nom 		: " + this.nom);
		System.out.println("Le prenom 	: " + this.prenom);
	}
	
	public int GetNumPers()
	{
		return this.num_pers;
	}
	public String GetNom()
	{
		return this.nom;
	}
	public String GetPrenom()
	{
		return this.prenom;
	}
	
	public void modifier(String n, String p)
	{
		this.nom=n;
		this.prenom=p;
	}
	
	public String toXML()
	{
		String xml="";
		xml = xml + "<numero>" + this.num_pers + "</numero>" + "\n";
		xml = xml + "<nom>" + this.nom + "</nom>" + "\n";
		xml = xml + "<prenom>" + this.prenom + "</prenom>" + "\n";
		return xml;
	}
}