Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java program that uses ArrayList and Iterator. It should input from user the names and ages of your few friends in a loop

Write a Java program that uses ArrayList and Iterator. It should input from user the names and ages of your few friends in a loop and add into ArrayList. Finally, it should use Iterator to display the data in a proper format. [Hint:- Lecture 02: Slide 8]
Sample output:
List of my Friends
Enter name and age [friend# 0]
Khalid Al-shamri
22.5
Do you want to add another friend (y/n)? y
Enter name and age [friend# 1]
Rahsed Al-anazi
21.1
Do you want to add another friend (y/n)? y
Enter name and age [friend# 2]
Salem Al-mutairi
23.7
Do you want to add another friend (y/n)? n
Here is the data you entered:
0. Khalid Al-shamri, 22.5
1. Rahsed Al-anazi, 21.1
2. Salem Al-mutairi, 23.7

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

More Books

Students also viewed these Databases questions

Question

Explain strong and weak atoms with examples.

Answered: 1 week ago

Question

Explain the alkaline nature of aqueous solution of making soda.

Answered: 1 week ago

Question

Comment on the pH value of lattice solutions of salts.

Answered: 1 week ago