Commit 600f86b0 authored by Alan BILLY's avatar Alan BILLY

Ajout du projet Magasin fini

parent 163d873d
Pipeline #2231 failed with stages
{
"java.project.sourcePaths": ["src"],
"java.project.outputPath": "bin",
"java.project.referencedLibraries": [
"lib/**/*.jar"
]
}
package Commande;
import Site.Site;
public class AssemblagePC implements Commande {
private Site site;
public AssemblagePC(Site site) {
this.site = site;
}
@Override
public void executer() {
site.AssemblagePC();
}
}
package Commande;
import Site.Site;
public class AssemblageServeur implements Commande {
private Site site;
public AssemblageServeur(Site site) {
this.site = site;
}
@Override
public void executer() {
site.AssemblageServeur();
}
}
package Commande;
public interface Commande {
public void executer();
}
import Commande.AssemblagePC;
import Commande.AssemblageServeur;
import Commande.Commande;
import Site.Site;
import Site.SiteConcerne;
public class Main {
public static void main(String[] args) {
Site site = SiteConcerne.getInstance();
// Création des commandes
Commande commandePC = new AssemblagePC(site);
Commande commandeServeur = new AssemblageServeur(site);
// Exécution des commandes
commandePC.executer();
commandeServeur.executer();
}
}
package Site;
public interface Site {
public void AssemblagePC();
public void AssemblageServeur();
}
package Site;
public class SiteConcerne implements Site {
private static SiteConcerne instance;
private SiteConcerne() {
}
public static SiteConcerne getInstance() {
if (instance == null) {
instance = new SiteConcerne();
}
return instance;
}
@Override
public void AssemblagePC() {
System.out.println("Assemblage d'un PC");
}
@Override
public void AssemblageServeur() {
System.out.println("Assemblage d'un Serveur");
}
}
# TP magasin
```
.
└── src
├── Commande
│ ├── AssemblagePC.java
│ ├── AssemblageServeur.java
│ └── Commande.java
├── Main.java
└── Site
├── Site.java
└── SiteConcerne.java
```
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment