01.02.2013 Views

Software Development Cross Solution - Index of - Free

Software Development Cross Solution - Index of - Free

Software Development Cross Solution - Index of - Free

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

You can download the Mercury Meals code from<br />

http://www.headfirstlabs.com/books/hfsd<br />

//...<br />

// Adds a meal order to a flight<br />

public void orderMeal(String[] options, String flightNo)<br />

The first line <strong>of</strong> code has already<br />

been added for you.<br />

}<br />

throws MealOptionNotFoundException,<br />

OrderNotAcceptedException {<br />

MercuryMeals mercuryMeals = MercuryMeals.getInstance();<br />

for (int x = 0; x < options.length;x++) {<br />

}<br />

// Finds all the orders for a specific flight<br />

public String[] getAllOrdersForFlight(String flightNo) {<br />

}<br />

// ...<br />

MercuryMeals mercuryMeals = MercuryMeals.getInstance();<br />

the next iteration<br />

return mercuryMeals.getOrdersThatMatchKeyword({flightNo});<br />

Add these code magnets<br />

into the main program.<br />

Order order = mercuryMeals.createOrder();<br />

MealOption mealOption = mercuryMeals.getMealOption(options[x]);<br />

if (mealOption != null) {<br />

order.addMealOption(mealOption);<br />

} else {<br />

}<br />

}<br />

order.addKeyword(flightNo);<br />

MercuryMeals mercuryMeals = MercuryMeals.getInstance();<br />

if (!mercuryMeals.submitOrder(order)) {<br />

throw new OrderNotAcceptedException(order);<br />

throw new MealOptionNotFoundException(mealOption);<br />

Download at WoweBook.Com<br />

you are here 4 367

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!