Stelios_Gakis

Seminar_1/Task_2

Sep 15th, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.08 KB | None | 0 0
  1. package Seminar_1;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Task_2 {
  6.     public static void main(String[] args) {
  7.  
  8.         Scanner input = new Scanner(System.in);
  9.         Boolean wrong;
  10.         String gender, customer, answer;
  11.         int age;
  12.  
  13.         do {
  14.             System.out.println("Are you a registered user? (Yes/No)");
  15.             customer = input.nextLine();
  16.  
  17.             System.out.println("Please enter your gender (Male/Female)");
  18.             gender = input.nextLine();
  19.  
  20.             System.out.println("Please enter your age ");
  21.             age = input.nextInt();
  22.  
  23.             System.out.printf("Your information is%nRegistered user : %S%nGender : %S%nAge : %d%n%nIs this information correct? (yes/no)%n", customer, gender, age);
  24.             input.nextLine();
  25.  
  26.             answer = input.nextLine();
  27.  
  28.             if (answer.equalsIgnoreCase("yes")){
  29.                 wrong = false;
  30.                 System.out.println("Thank you for visiting us");
  31.             }
  32.             else {
  33.                 wrong = true;
  34.             }
  35.  
  36.         } while (wrong);
  37.     }
  38. }
Add Comment
Please, Sign In to add comment