The program prompts the user to input the name and age of 5 people. It tracks the oldest and youngest ages entered, along with the corresponding names. After all inputs, it prints the name and age of the oldest and youngest person.
The program prompts the user to input the name and age of 5 people. It tracks the oldest and youngest ages entered, along with the corresponding names. After all inputs, it prints the name and age of the oldest and youngest person.
The program prompts the user to input the name and age of 5 people. It tracks the oldest and youngest ages entered, along with the corresponding names. After all inputs, it prints the name and age of the oldest and youngest person.
System.out.print("Enter name for person " + i + ": "); String name = input.nextLine(); System.out.print("Enter age for person " + i + ": "); int age = input.nextInt(); input.nextLine(); // Consume the newline character