Answered step by step
Verified Expert Solution
Question
1 Approved Answer
JAVA - Use scnr to read each pair of inputs, integer currAge and string currName, until - 1 is read from input. Create each Member
JAVA
Use scnr to read each pair of inputs, integer currAge and string currName, until is read from input. Create each Member object with currAge and currName as arguments and append each object to ArrayList memberList.
Ex: If the input is Kim Pat Rob then the output is:
Member age: Name: Kim
Member age: Name: Pat
Member age: Name: Rob
import java.util.Scanner;
import java.util.ArrayList;
public class Members
public static void mainString args
Scanner scnr new ScannerSystemin;
ArrayList memberList new ArrayList;
Member currMember;
int currAge;
String currName;
int i;
Your code goes here
for i ; i memberList.size; i
currMember memberList.geti;
currMember.print;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started