Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone explain to me what this code is trying to do? import java.util.*; public class Main { public static void main(String[] args) { Scanner

Can someone explain to me what this code is trying to do?

import java.util.*; public class Main { public static void main(String[] args) { Scanner sc= new Scanner(System.in); ArrayList first = new ArrayList<>(); // To store trainer who enrolled 0-5 members ArrayList second = new ArrayList<>(); // To store trainer who enrolled 6-12 members ArrayList third = new ArrayList<>(); // To store trainer who enrolled 13-20 members ArrayList fourth = new ArrayList<>(); // To store trainer who enrolled more than 20 members for(int i=0 ;i<=25;i++) { String name=sc.next(); int nw=sc.nextInt(); if(nw >=0 && nw<=5) first.add(name); else if(nw<=12) second.add(name); else if(nw<=20) third.add(name); else fourth.add(name); } System.out.println("Trainers who enrolled 0-5 new members :"); for(int i=0;i

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

Microsoft Visual Basic 2005 For Windows Mobile Web Office And Database Applications Comprehensive

Authors: Gary B. Shelly, Thomas J. Cashman, Corinne Hoisington

1st Edition

0619254823, 978-0619254827

More Books

Students also viewed these Databases questions

Question

4. I can tell when team members dont mean what they say.

Answered: 1 week ago