java - Is there any questions on here in relation to only taking "Mr", "Mrs", "Miss" etc at keyboard Input? -
this code. want accept correct male , female titles. how should fix work because @ moment not working correctly.
boolean valid = false; scanner keyboardin = new scanner(system.in); system.out.println("enter account details: "); { system.out.print("enter title: "); title = keyboardin.nextline(); if (title.equals("mr") || title.equals("mrs") || title.equals("ms") || title.equals("miss")) { system.out.println("title set. "); } name.settitle(title); else { system.out.println("error!, must enter correct title. "); } } while (!valid);
boolean valid = false; scanner keyboardin = new scanner(system.in); system.out.println("enter account details: "); string title; { system.out.print("enter title: "); title = keyboardin.nextline(); if (title.equals("mr") || title.equals("mrs") || title.equals("ms") || title.equals("miss")) { system.out.println("title set. "); name.settitle(title); valid = true; } else { system.out.println("error!, must enter correct title. "); } } while (!valid);
Comments
Post a Comment