Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class myApp {
- public static void main(String[] args){
- Scanner input = new Scanner(System.in);
- String q1,q2,q3,q4;
- boolean answer = true;
- while (answer) {
- System.out.println("please answer this questions! ");
- System.out.print("1) What is your name? ");
- q1 = input.nextLine();
- input.nextLine();
- System.out.print("2) How old are you? ");
- q2 = input.nextLine();
- System.out.print("3) what is your favorite color? ");
- q3 = input.nextLine();
- System.out.print("4) How many years have you been here in sweden? ");
- q4 = input.nextLine();
- System.out.printf("your answers are: %n 1) %s %n 2) %s %n 3) %s %n 4) %s %n ", q1, q2, q3, q4);
- System.out.print("are your answers right?(y/n)");
- String Answer = input.next();
- if (Answer.equals("y")){
- System.out.println("thank you for answering! ");
- answer = false;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement