Question: JAVA This homework is necessary preparation for the lab. Make sure you type your answers in a file you bring to the lab so that
JAVA
This homework is necessary preparation for the lab. Make sure you type your answers in a file you bring to the lab so that you will be able to quickly copy and paste them into the file provided in the lab.
Software Originals, Inc., has been hired by Eaton Wright, the "pizza king", to help automate a new chain of pizza delivery stores. SOI's system engineering staff have asked you to implement a prototype for the telephone operator's console. To start the project they have assigned you to implement the following two static methods (the first of which will be used to read files containing menus of pizza sizes and their prices, and pizza toppings and their prices; and the second of which will be used to read the first order from a file containing pizza orders whose total prices are to be calculated). They haven't had time to write formal specifications; hence the informal nature of the descriptions.
Implement the static method getPriceMap declared as follows:
| /** * Inputs a "menu" of words (items) and their prices from the given file and * stores them in the given {@code Map}. * * @param fileName * the name of the input file * @param priceMap * the word -> price map * @replaces priceMap * @requires
* @ensures [priceMap contains word -> price mapping from file fileName] */ private static void getPriceMap(String fileName, Map |
You may find some String methods (e.g., substring(int, int) and indexOf(char)) as well as the Integer class parseInt(String) static method to be useful in coding this method.
Implement the static method getOneOrder declared as follows:
| /** * Input one pizza order and compute and return the total price. * * @param input * the input stream * @param sizePriceMap * the size -> price map * @param toppingPriceMap * the topping -> price map * @return the total price (in cents) * @updates input * @requires
* @ensures
*/ private static int getOneOrder(SimpleReader input, Map Map |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
