java d'intervalle de resultat
Java
/**
* @author TTGamer
*/
public class Program
{
static Scanner scanne = new Scanner(System.in);
public static ArrayList<Article> articles = new ArrayList();
public static void main(String[] args)
{
do{
//searchByIntervalle
System.out.println("\n----------------------------------------\n"
+ "Bienvenue dans l'intervalle de prix\n"
+ "----------------------------------------\n");
System.out.print("Veuillez saisir un prix minimum\n> ");
int prixMin = scanne.nextInt();
System.out.println("Veuillez saisir un prix maximum\n> ");
int prixMax = scanne.nextInt();
Program.searchByIntervalle(prixMin, prixMax);
// Demmamde a l'utilisateur si il veut continuer
System.out.print("\nVoulez-vous continuer le programme ?(oui/non)\n> ");
repBoucle = scanne.next();
if (repBoucle.equals("oui"))
{
boucle = true;
}
System.out.println("\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
} while (boucle == true)
}
// Methode in build
protected static void searchByIntervalle(int prixMin, int prixMax) {
articles.forEach((article) -> {
if (prixMin >= 0 && prixMax <= 6000) {
System.out.println("\nArticle correspondant à votre recherche :");
System.out.println(" - Id : " + article.getId());
System.out.println(" - Nom : " + article.getName());
System.out.println(" - Prix : " + article.getPrix());
System.out.println(" - Stock : " + article.getStock());
} else {
System.err.println("----------------------------------------\n"
+ "Aucun article trouvé !\n"
+ "----------------------------------------");
}
});
}
}
// class article
/**
*
* @author TTGamer
*/
public class Article {
private int id;
private String name;
private int prix;
private int stock;
public Article(int id, String name, int prix, int stock) {
this.id = id;
this.name = name;
this.prix = prix;
this.stock = stock;
}
protected int getId() {
return this.id;
}
protected void setId(int id) {
this.id = id;
}
protected String getName() {
return this.name;
}
protected void setName(String name) {
this.name = name;
}
protected int getPrix() {
return this.prix;
}
protected void setPrix(int prix) {
this.prix = prix;
}
protected int getStock() {
return this.stock;
}
protected void setStock(int stock) {
this.stock = stock;
}
}
Also in Java:
- Title
- how to access private vairable in java method
- Category
- Java
- Title
- java newinstance alternative
- Category
- Java
- Title
- java pass arraylist by value
- Category
- Java
- Title
- properties java 8 maven in pom xml
- Category
- Java
- Title
- count number of matches in two strings java
- Category
- Java
- Title
- java file download
- Category
- Java
- Title
- java android development get element by id
- Category
- Java
- Title
- java simple jframe example
- Category
- Java
- Title
- how to get the dimensions of a 2d array in java
- Category
- Java
- Title
- how to add a number to an array in java
- Category
- Java
- Title
- java last element in array
- Category
- Java
- Title
- java prev_permutation
- Category
- Java
- Title
- how to append to an array in java
- Category
- Java
- Title
- usaco 2018 january contest
- Category
- Java
- Title
- read csv java
- Category
- Java
- Title
- java length of matrix
- Category
- Java
- Title
- double to string java
- Category
- Java
- Title
- convert char to string java
- Category
- Java
- Title
- java how to read a text file
- Category
- Java
- Title
- kotlin jsonobject get nested
- Category
- Java
- Title
- java script snippet for responsive
- Category
- Java
- Title
- java 8 loop in map
- Category
- Java
- Title
- expression régulière téléphone java
- Category
- Java
- Title
- android studio java random number generator
- Category
- Java
- Title
- java map iteration
- Category
- Java
- Title
- cordova cannot find symbol import com.google.firebase.iid.FirebaseMessagingService;
- Category
- Java
- Title
- how to make a variable unchangeable in java
- Category
- Java
- Title
- find first non repeating character in a string
- Category
- Java
- Title
- java spring boot json deserialize date inaccurate
- Category
- Java
- Title
- get certain character from string java
- Category
- Java
- Title
- int4 spring jpa failling create command
- Category
- Java
- Title
- stack overflow recyclerview
- Category
- Java
- Title
- how to send http post create request using curl command
- Category
- Java
- Title
- how to convert string to double in android studio
- Category
- Java
- Title
- jackson ignore values if empty
- Category
- Java
- Title
- how to read in a file in java
- Category
- Java
- Title
- how do i print text in java
- Category
- Java
- Title
- boolean checkbox swing
- Category
- Java
- Title
- java for loop add multiple declarations
- Category
- Java
- Title
- java get annotation value
- Category
- Java
- Title
- compareto method java
- Category
- Java
- Title
- java vector push_back
- Category
- Java
- Title
- how to take max value from priority queue in java
- Category
- Java
- Title
- java catch multiple exceptions
- Category
- Java
- Title
- continue in java
- Category
- Java
- Title
- how to create a thread local variable in java
- Category
- Java
- Title
- kotlin android intent pass data
- Category
- Java
- Title
- convert date to calendar java
- Category
- Java
- Title
- how to remove duplicates from an array java
- Category
- Java
- Title
- summary of operator java
- Category
- Java
- Title
- how to create a 2d arraylist java
- Category
- Java
- Title
- add certificate to java truststore
- Category
- Java
- Title
- strong password regular expression java
- Category
- Java
- Title
- how to get a user to add to an arraylist in java
- Category
- Java
- Title
- selection sort in java
- Category
- Java
- Title
- java generate list of random element
- Category
- Java
- Title
- center textview programmatically android
- Category
- Java
- Title
- primitive data types in java
- Category
- Java
- Title
- final variables in java
- Category
- Java
- Title
- difference between print and println in java
- Category
- Java
- Title
- how to remove all special characters from a string in java
- Category
- Java
- Title
- import java.util.hashset
- Category
- Java
- Title
- how to do sex java
- Category
- Java
- Title
- how to change the color of a menubar in java
- Category
- Java
- Title
- déclarer un tableau en java
- Category
- Java
- Title
- java execute jar from main
- Category
- Java
- Title
- read csv java android
- Category
- Java
- Title
- list in java
- Category
- Java
- Title
- arraylist in java
- Category
- Java
- Title
- java get keys from hashmap
- Category
- Java
- Title
- boolean java.lang.String.equals(java.lang.Object)' on a null object reference
- Category
- Java
- Title
- set java
- Category
- Java
- Title
- system.in example in java
- Category
- Java
- Title
- how to replace in java
- Category
- Java
- Title
- insert element into arraylist java
- Category
- Java
- Title
- log10 in java
- Category
- Java
- Title
- java 8 hashmap example stackoverflow
- Category
- Java
- Title
- java lerp
- Category
- Java
- Title
- in dom parser how to find processing instruction in java
- Category
- Java
- Title
- java random boolean
- Category
- Java
- Title
- main method java
- Category
- Java
- Title
- sieve in java
- Category
- Java
- Title
- string to char in java
- Category
- Java
- Title
- java manacher's algorithm
- Category
- Java
- Title
- for next loop javasxcrop
- Category
- Java
- Title
- java switch
- Category
- Java
- Title
- import
- Category
- Java
- Title
- convert string into unicode java
- Category
- Java
- Title
- java literals w3schools
- Category
- Java
- Title
- split every character in string into array java
- Category
- Java
- Title
- how to make a searchable list in java
- Category
- Java
- Title
- java shortest if else statement
- Category
- Java
- Title
- capacitor-android. Unfortunately you can't have non-Gradle Java modules and Android-Gradle modules in one project
- Category
- Java
- Title
- how to add strings in java
- Category
- Java
- Title
- iterate over map keys java
- Category
- Java
- Title
- how to make an arraylist java
- Category
- Java
- Title
- java map example
- Category
- Java
- Title
- java for
- Category
- Java
- Title
- casting java
- Category
- Java
- Title
- .length array java
- Category
- Java