Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- /**
- *
- * @author UIRDT1176
- */
- public class Ville {
- String nom;
- String pays;
- double nbreHabitentes;
- char categorie;
- public Ville(String nom, String pays, double NbreHabitentes, char Categorie) {
- this.nom = nom;
- this.pays = pays;
- this.nbreHabitentes = nbreHabitentes;
- this.categorie = categorie;
- }
- public String getNom() {
- return nom;
- }
- public String getPays() {
- return pays;
- }
- public double getNbreHabitentes() {
- return nbreHabitentes;
- }
- public char getCategorie() {
- return categorie;
- }
- public void setNom(String nom) {
- this.nom = nom;
- }
- public void setPays(String prenom) {
- this.pays ="";
- }
- public void setNbreHabitentes(double NbreHabitentes) {
- this.nbreHabitentes = NbreHabitentes;
- }
- public void setCategorie() {
- int borne[]= { 0,100,1000,100000,500000 , 1000000, 5000000, 10000000 };
- char Categorie[]={'!','A','B','C','D','E','E','F','G','H'};
- int i=0;
- while( i < borne.length && this.nbreHabitentes >= borne[i])
- {
- i++;
- }
- this.categorie = Categorie[i];
- }
- public String comparer(Ville e)
- {
- if(this.nbreHabitentes == e.nbreHabitentes )
- {
- return"les deux ville ont les meme nombre d'habitentes";
- }
- else if (this.nbreHabitentes != e.nbreHabitentes)
- return"les deux sont pas egaux ";
- return null;
- }
- public void afficher (Ville e)
- {
- System.out.println("la ville " +this.nom+ "de " +this.pays+ " a " +this.nbreHabitentes+ " nombre d'habitents" );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement