Ask Other Engineering Expert

For your assignment, turn in two m-files, a function and a script.

The Krusty Krab is open daily and features 3 items on the menu: Krabby Patties, Kelp Rings, and Coral Bits. They each cost $1.25, $1.50, and $1.00 respectively.

In this simulation we will assume there are an unlimited number of potential customers who want to order. The Krusty Krab can only close after all items have been sold.

Every customer has a 1 in 3 chance of ordering each item from the menu while all 3 items are in stock. This means that a customer could order 0 items, 1 item, 2 items, or all 3 items (The probability of ordering all three is (1/3)*(1/3)*(1/3) = 1/27).

If an item runs out of stock then the probability of the other 2 items gets raised to a 1 in 2 chance of ordering each item. If there is only 1 item left, then the probability of that item gets raised to a 3 in 4 chance of ordering it.

YOUR FUNCTION -

Create a function with three scalar inputs: number of Krabby Patties (P), number of Kelp Rings(R), and number of Coral Bits(B), and two outputs: total revenue "Rev" a scalar, and inventory "Inv" a matrix.

1. Initialize a 1x3 vector of zeros called Orders. Each row represents a customer. The first column represents Krabby Patties, second is Kelp Rings, third is Coral Bits. The columns should be filled with 0s and 1s. 1s represent if the item was bought and 0s represent if the item was not bought.

2. Initialize a 1x1 vector called CustRev and store the revenue generated from each customer in it.

3. Initialize your Inv vector using the three inputs, P, R, and B. Inv represents the amount of inventory of each of the three items, when a customer is done ordering.

4. Create a while loop to keep the simulation running until all items have been sold. I'd recommend creating a scalar that represents the total number of items remaining, and updating it each iteration.

a. Decide if the customer bought each item with the probabilities listed above and mark the column in Orders with a 0 or 1. Use an "if" statement to adjust the probabilities for each item in an order depending on how many items are left in stock.

b. Update Orders and Inv depending on what items the customer may have bought.

c. In the CustRev vector, calculate the cost of the order and add in tip. 7% tip if they bought 1 item, 10% if they bought 2 items, and 15% if they bought all 3 items.

d. At the end of each iteration in the loop, if the total is still greater than 0, add another row of zeros to Orders, a zero to the end of the CustRev vector, and a new row to the end of Inv that is the current inventory. Basically, these variables grow each iteration.

5. Calculate the total revenue generated from the day and store the value as the output (Rev).

YOUR SCRIPT

Create a script that will compare the total revenues from multiple days of service.

1. Initialize a 1x7 vector of zeros called RevWeek.

2. Use a for loop to call the function 7 separate times, with P=300, R=300, and B=300 as the initial values (inputs) each time. Store the revenue outputs in the RevWeek vector.

3. Each time through the loop, plot each column of the Inventory output on one plot with three separate subplots, using subplot(3,1,...). So on one subplot, you'll have 7 lines representing the value of P throughout the day, and then 7 separate lines for R, and then for B.

4. After the loop is done, plot RevWeek using appropriate titles and axes labels.

5. Create a 1x30 vector of zeros called "RevMonth".

6. Use a for loop to call the function 30 separate times with variables, P=300, R=150, B=150. Store the results in the RevMonth vector.

7. For each iteration, keep track of the number of customers it takes to sell out and store this in a vector too, called "Customers"

8. Create identical plots as you did for the weekly revenue, i.e. Inv and RevMonth. Use a comment in your code to discuss the results in a few sentences.

9. Plot the RevMonth and Customers results on two separate histograms using "hist"

Other Engineering, Engineering

  • Category:- Other Engineering
  • Reference No.:- M92707808

Have any Question?


Related Questions in Other Engineering

Register design a cpu register is simply a row of

Register design A CPU register is simply a row of flip-flops (i.e. SR, JK, T, etc) put side by side in an array to make the size of register required. For example, an 8 bit register has 8 flip-flops side by side for stor ...

A detailed review of spatial modulation and simulation

A Detailed Review of Spatial Modulation and Simulation Learning Outcomes a. Learn how to model mobile communication channels d. Discern knowledge development and directions on the recent advances in 4G to the research pr ...

Mine safety amp environmental engineering assignment -part

Mine Safety & Environmental Engineering Assignment - Part 1 - Questions 1. Occupational health and safety is the primary factor that needs to be considered in the mining industry. Discuss this statement. 2. Define the fo ...

Projectflow processing of liquor in a mineral refining

Project Flow Processing of Liquor in a Mineral Refining Plant The aim of this project is to design a flow processing system of liquor (slurry) in a mineral (aluminum) refining plant. Aluminum is manufactured in two phase ...

Learning outcomes evaluate multiuser communication and

Learning Outcomes Evaluate multiuser communication and resource sharing techniques; Apply the techniques of, and report on, digital communication applications using Matlab and hardware devices. Assignment Description The ...

Operations engineering assignment -please select only one

Operations Engineering Assignment - Please select only one of the following case studies for your assignment: CASE A. Tesla Motors Tesla is an innovative manufacturer that designs, assemble and sells fully electric vehic ...

Select a risk problem from the list below and prepare a

Select a risk problem from the list below and prepare a risk management plan in accordance with AS/NZS ISO 31000:2009. Please ensure that: - Establish the context clearly, in accordance with the Standard; - Define your s ...

Engineering materials term paper assignment -conduct a

ENGINEERING MATERIALS TERM PAPER ASSIGNMENT - Conduct a thorough literature search and write a 15-20 page technical review paper on the evolution of the engineering materials used in the manufacturing of any one of the f ...

Task 1using the lab kit design a circuit for the processor

Task 1: Using the lab kit, design a circuit for the processor to control the output of a connected 7-segment LED display device. You will be provided with a standard common anode 7-segment display of the type FND-507 (or ...

Control theory - lab reportsfor experiments 1 to 4 you must

Control Theory - Lab Reports For experiments 1 to 4 you must undertake the following: a) At the start of each section (including the pre-lab activities) there are a number learning outcomes. That is, what students should ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As