AP CSA FRQ Guide
2010 FRQ 1: MasterOrder
Calculate total cookie boxes across orders and remove all orders for a specified variety while returning the total removed boxes.
ArrayList Aggregation and Removal22 minute targetArrayListobjectsaggregationremoval
Skills Tested
What this FRQ is really practicing
ArrayListobjectsaggregationremoval
Review these topics before attempting the problem.
Starter Approach
How to begin with your own plan
- 1Sum box counts from every CookieOrder in the list.
- 2Remove matching varieties and accumulate the number of boxes removed.
Attempt the problem before opening the solution.
Common Mistakes
Mistakes to watch for while writing
Counting removed orders instead of removed boxes.
Skipping adjacent matching orders in a forward removal loop.
Using == for cookie variety comparison.
Self Check
Review questions before you submit
Sums boxes across all orders.
Call the CookieOrder accessor for number of boxes.
Compares cookie variety names correctly.
Use equals for String values.
Removes all matching varieties.
Avoid skipping items after removal.
Returns the total boxes removed.
The return value is a box count, not the number of removed orders.
Practice Links
