Created
November 15, 2022 09:54
-
-
Save chamellion/252851190562a556ee0fdee7ad040d29 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package plab; | |
import java.util.ArrayList; | |
import java.util.Scanner; | |
public class AssessedPart { | |
public static void main(String[] args) { | |
ArrayList<Integer> ageArray = new ArrayList<>(); | |
ArrayList<String > namesArray = new ArrayList<>(); | |
Scanner scanner = new Scanner(System.in); | |
int counter = 0; | |
String name = ""; | |
while (true){ | |
if (counter == 3) break; | |
System.out.println("Please enter your name: "); | |
name = scanner.next(); | |
if (name.equalsIgnoreCase("done")) break; | |
namesArray.add(name); | |
System.out.println("Please enter your age: "); | |
int age = scanner.nextInt(); | |
ageArray.add(age); | |
counter++; | |
} | |
System.out.println(ageArray); | |
System.out.println(namesArray); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment