import java.util.Collection; import java.util.Scanner; /** * Stores a List of MenuItems and provides a method return these
Question:
import java.util.Collection; import java.util.Scanner;
/** * Stores a List of MenuItems and provides a method return these items in a * formatted String. May be constructed from an existing List or from a file * with lines in the format: * *
1.25 hot dog 10.00 pizza ... ** */ public class Menu {
// Attributes.
// your code here
/** * Creates a new Menu from an existing Collection of MenuItems. MenuItems are * copied into the Menu List. * * @param items an existing Collection of MenuItems. */ public Menu(Collection
// your code here
}
/** * Constructor from a Scanner of MenuItem strings. Each line in the Scanner * corresponds to a MenuItem. You have to read the Scanner line by line and add * each MenuItem to the List of items. * * @param fileScanner A Scanner accessing MenuItem String data. */ public Menu(Scanner fileScanner) {
// your code here
}
/** * Returns the List's i-th MenuItem. * * @param i Index of a MenuItem. * @return the MenuItem at index i */ public MenuItem getItem(int i) { return null; // your code here }
/** * Returns the number of MenuItems in the items List. * * @return Size of the items List. */ public int size() {
// your code here
return 0; }
/** * Returns the Menu items as a String in the format: * *
5) poutine $ 3.75 6) pizza $10.00 ** * where n) is the index + 1 of the MenuItems in the List. */ @Override public String toString() {
// your code here
return null; } }
Advanced Financial Accounting
ISBN: 978-0078025624
10th edition
Authors: Theodore E. Christensen, David M. Cottrell, Richard E. Baker