Question: 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

1 Expert Approved Answer
Step: 1 Unlock

The code you provided seems to have some logical and syntax errors as well as being incomplete To en... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!