Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

How could I add to the below code to be more complex? Here is the question I had to answer Trainers at Tom's Athletic Club

How could I add to the below code to be more complex?

Here is the question I had to answer "Trainers at Tom's Athletic Club are encouraged to enroll new members. Write an application that allows Tom to enter the names of each of his 25 trainers and the number of new members each trainer has enrolled this year. Output is the number of trainers who have enrolled 0 to 5 members, 6 to 12 members, 13 to 20 members, and more than 20 members."

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

The code you provided seems to have some logical and syntax errors as well as being incomplete To en... 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_2

Step: 3

blur-text-image_step3

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 explore these related Databases questions

Question

=+j Enabling a productive global workforce.

Answered: 3 weeks ago

Question

=+ Are you interested in creating or

Answered: 3 weeks ago