Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- System.out.print("Make Your Selection\n 1: Add A Name to the Database\n 2: List Names\n 3: Search for Names\n Your Selection: ");
- int userSelect = input.nextInt();
- if (userSelect == 1) {
- enterName();
- }
- else if (userSelect == 2) {
- listNames(ArrayList<String>);
- }
- }
- public static void enterName() {
- Scaner input = new Scanner(System.in);
- System.out.print("Please enter a name now: ");
- String nameInput = input.next();
- ArrayList<String> names = new ArrayList<String>();
- if (nameInput != " ") {
- names.add(nameInput);
- }
- else {
- System.out.println("Please enter a name!");
- }
- }
- public static void listNames(ArrayList<String> names) {
- for (int i = 0; i < names.size(); i++) {
- System.out.println(names);
- }
- }
- }
Add Comment
Please, Sign In to add comment