Click here to Skip to main content
15,906,106 members

Comments by Member Hemal (Top 1 by date)

Member Hemal 21-Mar-18 5:15am View    
Here is your solution .....




import java.util.*;

public class scanner
{
public static void main(String[] args)
{
Scanner userInput = new Scanner(System.in);

String version = "v1";
String wlcmsg;


wlcmsg = "Welcome to Interviwer " + version + ".";
System.out.print(wlcmsg);
System.out.println(" Please press 'enter' to continue...");

try
{
System.in.read();
}
catch (Exception e)
{

}
for(int clear = 0; clear <= 50; clear++)
{
System.out.println(" ");
}

System.out.println("\n");
String blank = userInput.nextLine();
System.out.println(blank + "Please enter your name: ");
String name = userInput.nextLine();

for(int clear = 0; clear <= 50; clear++)
{
System.out.println(" ") ;
}

System.out.print("Hello " + name + ", I am your personal interviewer " + version + "\n" + "So, How old are you?");
int age = userInput.nextInt();

for(int clear = 0; clear <= 50; clear++)
{
System.out.println(" ") ;
}

System.out.println("So your name is " + name + " and you are " + age + " years old." + "\n" + "Is this correct?");
Scanner options = new Scanner(System.in);

String ans = options.next();

if(ans.equalsIgnoreCase("y")||ans.equalsIgnoreCase("options"))
{

System.out.println("This will be fun");
}
else if(ans.equalsIgnoreCase("n")||ans.equalsIgnoreCase("no"))
{
System.out.println("Maybe next time");
}
else
{
System.out.println("Invalid character");
}
}
}