Question: Follow instructions as closely as possible !!!! Please and also: The findLargestRegiment method of your Army class must be called from the printReport method of

Follow instructions as closely as possible !!!! Please and also:
The findLargestRegiment method of your Army class must be called from the
printReport method of the Army class. It cannot be called from main().
Why? Because only the Army class has access to the arraylist of Regiments
to remove the largest. If you attempted to fix this by making the
arraylist public (or by not making it specifically private) that is
_breaking encapsulation_ - a violation of the "prime directive" of OOP -
and you will not be happy with your grade.
Note that you do not have to actually remove the largest regiment, as long
as it does not appear in any future reports. If you figured out some
other way to do this, that is fine.
Your findLargestRegiment method may return either a pointer to the largest
regiment (see the Bank class) or its index, because the ArrayList class has
overloaded _remove_ methods:
1. list.remove(index) - removes the object at the specified index
2. list.remove(obj) - searches the list for an object equal to _obj_ and,
if found, removes it
 Follow instructions as closely as possible !!!! Please and also: The
findLargestRegiment method of your Army class must be called from the printReport
method of the Army class. It cannot be called from main(). Why?

Programming Assignment (ArrayLists) . Problem Statement The following story is told about the Russian army at the time of the Russo- Japanese War: It seems that 20 regiments were in a continuous process of formation. The first had 1000 men, the second had 950, the third 900, and so on down to the twentieth regiment, which garrisoned only 50. During each week, 100 men were added to each regiment, and at week's end, the largest regiment was sent off to the front. Apparently, the commander of t5th regiment was a wonderful chess player To delay his eventual trip to the front, the General of the Army (who happened to be his chess partner) sent him only thirty new recruits each week (instead of 100) Write a Java program that tells which regiment is sent to the front each week, shows tstatus of the remaining regiments, and determines exactly how long it takes for the chess-playing commander to go to the front

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!