Advertisement
dawciobiel

odpowiedz na facebooku - kod

May 14th, 2020
560
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.04 KB | None | 0 0
  1.             switch (keypressed) {
  2.                 case keypressed:
  3.                     // something to do
  4.                     break;
  5.                 case keypressed:
  6.                     // something to do
  7.                     break;
  8.             }
  9.  
  10. public class QAClass {
  11.    public String question;
  12.    public String answer;
  13.    
  14.    public QAClass(String question) {
  15.      this.question = question;
  16.    }
  17.  
  18.    public void getQuestion() {
  19.      System.out.print(this.question);
  20.    }
  21.    
  22.    public void setAnswer() {
  23.      this.answer = scanner.nextLine();
  24.    }
  25.    
  26.    @Override
  27.    public String toString() {
  28.      return this.question + " " + answer;
  29.    }
  30. }
  31.  
  32. private LinkedList<QAClass> createQuestionList() {
  33.    LinkedList<QAClass> list = new LinkedList<>();
  34.    list.add(new QAClass("Podaj imie pracownika: "));
  35.    list.add(new QAClass("Podaj wiek pracownika: "));
  36.  
  37.    return list;
  38. }
  39.  
  40.  
  41. private LinkedList<QAClass> askAllQuestionsToUser() {
  42.    for(QAClass qa: questionsList) {
  43.      qa.getQuestion();
  44.      qa.setAnwer();
  45.    }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement