Which Collection Classes?
For each scenario, describe which Collection class(es) you would use, how you would use the class(es), and why you choose the class(es).
a. You want to maintain a list of foods together with the number of calories in each food. Your list should allow a user to specify a food and retrieve the number of calories for that food. You should be able to add new foods to the list.
b. You want to maintain a list of your daily meals—foods and calories. You should be able to specify a particular day and retrieve the day’s meals. You should be able to retrieve the total number of calories for any consecutive number of days.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here