Answered step by step
Verified Expert Solution
Link Copied!

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 -1 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 10 Kim 5 Pat 70 Rob -1, then the output is:
Member age: 10, Name: Kim
Member age: 5, Name: Pat
Member age: 70, Name: Rob
import java.util.Scanner;
import java.util.ArrayList;
public class Members {
public static void main(String[] args){
Scanner scnr = new Scanner(System.in);
ArrayList memberList = new ArrayList();
Member currMember;
int currAge;
String currName;
int i;
/* Your code goes here */
for (i =0; i < memberList.size(); ++i){
currMember = memberList.get(i);
currMember.print();
}
}
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

10th Edition

0137916787, 978-0137916788

More Books

Students also viewed these Databases questions

Question

Define Management by exception

Answered: 1 week ago

Question

Explain the importance of staffing in business organisations

Answered: 1 week ago

Question

What are the types of forms of communication ?

Answered: 1 week ago

Question

3. Contrast relational contexts in organizations

Answered: 1 week ago

Question

2. Describe ways in which organizational culture is communicated

Answered: 1 week ago

Question

1. Describe and compare approaches to managing an organization

Answered: 1 week ago