reorganisation + hashmap
This commit is contained in:
21
q2/algo/cours6/Question.java
Normal file
21
q2/algo/cours6/Question.java
Normal file
@ -0,0 +1,21 @@
|
||||
public class Question {
|
||||
private String text;
|
||||
private String response;
|
||||
|
||||
private String user_input;
|
||||
|
||||
public Question(text, response){
|
||||
this.text = text;
|
||||
this.response = response;
|
||||
}
|
||||
|
||||
public void Poser(){
|
||||
Scanner resp = new Scanner(System.in);
|
||||
System.out.println(text + ": ")
|
||||
user_input = resp.nextLine();
|
||||
}
|
||||
|
||||
public boolean Verifier(){
|
||||
return user_input == response;
|
||||
}
|
||||
}
|
18
q2/algo/cours6/Questionnaire.java
Normal file
18
q2/algo/cours6/Questionnaire.java
Normal file
@ -0,0 +1,18 @@
|
||||
public class Questionnaire {
|
||||
private Question[] questions;
|
||||
|
||||
public void add_question;
|
||||
|
||||
public void poser_tout(){
|
||||
for(Question q: questions){
|
||||
q.Poser();
|
||||
if(q.Verifier())
|
||||
System.out.println("Bravo");
|
||||
else
|
||||
System.out.println("Pas ouf");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
4
q2/algo/cours6/TestsQuestionnaire.java
Normal file
4
q2/algo/cours6/TestsQuestionnaire.java
Normal file
@ -0,0 +1,4 @@
|
||||
public class TestsQuestionnaire {
|
||||
public static void main(String[] args) {
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user