java d 27intervalle de resultat

Solutions on MaxInterview for java d 27intervalle de resultat by the best coders in the world

showing results for - "java d 27intervalle de resultat"
Fabio
02 Oct 2019
1/**
2*   @author TTGamer
3*/
4 
5public class Program
6{
7    static Scanner scanne = new Scanner(System.in);
8    public static ArrayList<Article> articles = new ArrayList();
9 
10    public static void main(String[] args)
11    {
12        do{
13            //searchByIntervalle
14            System.out.println("\n----------------------------------------\n"
15                        + "Bienvenue dans l'intervalle de prix\n"
16                        + "----------------------------------------\n");
17            System.out.print("Veuillez saisir un prix minimum\n> ");
18            int prixMin = scanne.nextInt();
19            System.out.println("Veuillez saisir un prix maximum\n> ");
20            int prixMax = scanne.nextInt();
21            Program.searchByIntervalle(prixMin, prixMax);
22 
23            // Demmamde a l'utilisateur si il veut continuer
24            System.out.print("\nVoulez-vous continuer le programme ?(oui/non)\n> ");
25            repBoucle = scanne.next();
26            if (repBoucle.equals("oui"))
27            {
28                boucle = true;
29            }
30            System.out.println("\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
31        } while (boucle == true)
32    }
33 
34 
35    // Methode in build
36    protected static void searchByIntervalle(int prixMin, int prixMax) {
37        articles.forEach((article) -> {
38            if (prixMin >= 0 && prixMax <= 6000) {
39                System.out.println("\nArticle correspondant à votre recherche :");
40                System.out.println(" - Id : " + article.getId());
41                System.out.println(" - Nom : " + article.getName());
42                System.out.println(" - Prix : " + article.getPrix());
43                System.out.println(" - Stock : " + article.getStock());
44            } else {
45                System.err.println("----------------------------------------\n"
46                                + "Aucun article trouvé !\n"
47                                + "----------------------------------------");
48            }
49        });
50    }
51}
52 
53 
54// class article
55/**
56 *
57 * @author TTGamer
58 */
59public class Article {
60 
61    private int id;
62    private String name;
63    private int prix;
64    private int stock;
65 
66    public Article(int id, String name, int prix, int stock) {
67        this.id = id;
68        this.name = name;
69        this.prix = prix;
70        this.stock = stock;
71    }
72 
73    protected int getId() {
74        return this.id;
75    }
76 
77    protected void setId(int id) {
78        this.id = id;
79    }
80 
81    protected String getName() {
82        return this.name;
83    }
84 
85    protected void setName(String name) {
86        this.name = name;
87    }
88 
89    protected int getPrix() {
90        return this.prix;
91    }
92 
93    protected void setPrix(int prix) {
94        this.prix = prix;
95    }
96 
97    protected int getStock() {
98        return this.stock;
99    }
100 
101    protected void setStock(int stock) {
102        this.stock = stock;
103    }
104 
105}