Write a method that takes an ArrayList of String
and returns an ArrayList of Integer containing
the lengths of the strings.
Write a method that takes an ArrayList of String
and inserts the String "really" immediately
before any occurrence of "good" or "bad".
Write a method that takes an ArrayList of Sale
objects and a String day name and returns a
new ArrayList of Sale objects containing only
the Sale objects from that day. It should not modify the
argument ArrayList.
Write a method that takes an ArrayList of Sale
objects and a String and returns the average units sold for
the given day. To compute the average units sold for a given day, find all
the sales that occurred on that day and count them and total the units
sold and then compute the average.
Write a method that takes an ArrayList of Sale
objects and returns the Sale object with the highest value
(number of units times unit price).
Write a method that takes an ArrayList of Sale
objects and an int target and returns a boolean indicating
whether the total value of any Sale (number of units times
unit price) is greater than the target.
A few more ArrayList methods to practice with. Several of the
problem in this set use a class Sale which represents a sale of
some number of a given kind of item at a certain price on a particular day.
The Sale class provides the instance methods String
day(), String item(), int units(),
and int unitPrice() to access the values of
the Sale object.