Advertisement
Stelios_Gakis

Exercise_3/Task_2

Sep 14th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.93 KB | None | 0 0
  1. package Exercise_3;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Task_2 {
  6.     public static void main(String[] args) {
  7.         Scanner input = new Scanner(System.in);
  8.         String name, address, phone, q = "";
  9.  
  10.         while (!q.equals("yes")) {
  11.             System.out.println("Please enter your name");
  12.             name = input.nextLine();
  13.             System.out.println("Please enter your address");
  14.             address = input.nextLine();
  15.             System.out.println("Please enter your phone number");
  16.             phone = input.nextLine();
  17.  
  18.             System.out.printf("Name: %s%nAddress: %s%nPhone number: %s%n%n", name, address, phone);
  19.             try {
  20.                 Thread.sleep(1000);
  21.             } catch (InterruptedException e) {
  22.                 e.printStackTrace();
  23.             }
  24.             System.out.println("Is this information correct? (yes/no)");
  25.             q = input.nextLine();
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement