Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Seminar_1;
- import java.util.Scanner;
- public class Task_2 {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- Boolean wrong;
- String gender, customer, answer;
- int age;
- do {
- System.out.println("Are you a registered user? (Yes/No)");
- customer = input.nextLine();
- System.out.println("Please enter your gender (Male/Female)");
- gender = input.nextLine();
- System.out.println("Please enter your age ");
- age = input.nextInt();
- System.out.printf("Your information is%nRegistered user : %S%nGender : %S%nAge : %d%n%nIs this information correct? (yes/no)%n", customer, gender, age);
- input.nextLine();
- answer = input.nextLine();
- if (answer.equalsIgnoreCase("yes")){
- wrong = false;
- System.out.println("Thank you for visiting us");
- }
- else {
- wrong = true;
- }
- } while (wrong);
- }
- }
Add Comment
Please, Sign In to add comment