-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBus.java
More file actions
33 lines (22 loc) · 923 Bytes
/
Bus.java
File metadata and controls
33 lines (22 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package com.usthb.modeles;
//classe bus
public class Bus extends MoyenTransport{
//variables propre au bus
private static int n = 0;
private int nombreSiege;
//On appelle le constructeur de la super classe et on rajoute les attributs de la sous classe
public Bus(long numeroSerie, String matricule, String modele, String entreprise,TypeMoyen type, int nombreSiege){
super(numeroSerie,matricule,modele,entreprise);
this.numeroSequentiel = String.format("%s%03d",TypeMoyen.BUS,n);
this.nombreSiege = nombreSiege;
n++;
}
//getter de l'attribut de la classe
public int getNombreSiege(){
return nombreSiege;
}
// redéfinition de la méthode toString pour complementer la classe bus
public String toString(){
return super.toString() + String.format("\nNombre de siege: %d\n", nombreSiege);
}
}