package hw06;

import java.util.Scanner;

public class Question {
	String text;
	String answer;
	
	public Question(String text) { 
		this.text = text; 
		this.answer = "";
	}
	
	public void setAnswer(String answer) { this.answer = answer; }

	public boolean checkAnswer(String response) {
		response=response.trim();
		return response.equalsIgnoreCase(answer); 
	}


	public void display() {
		System.out.println(text);
	}
	
	public boolean presentQuestion(Scanner in) {
		display();
		String response = in.nextLine();
		boolean right = checkAnswer(response);
		System.out.println("You answer is " + (right?"right":"wrong") + ".");
		return right;
	}
	

}
