Chan H.

asked • 11/04/22

How do I approach this programming prompt?

=================================
An ordering service allows customers to order filled breads.
The bread comes in two sizes:
-30cm
-15cm
And three types:

-White
-Brown
-Seeded
There are five filling choices:
-Beef
-Chicken
-Cheese
-Egg
-Tuna
-Turkey
The ordering service calculates the number of each: 
• size of bread sold
• type of bread (white, brown, or seeded) sold
• filling sold.

The customer is then asked to confirm their order, alter their choices, or choose not to proceed.

================================

The approach I've tried (In Python) is:

  1. Initialized a 2D array with the format (Filling, Quantity of sales)
  2. Various loops used to output fillings
  3. As soon as the filling is selected, the 2D array index [1][i] is incremented by 1.

However, I've run into some issues such as not being able to alter the order once it has been placed and it does not look like the most efficient solution. How do I approach this prompt with a better solution?



1 Expert Answer

By:

Sheel P. answered • 11/05/22

Tutor
5 (4)

Software Engineer at Amazon with 4+ years of experience

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.