Please use Mathematica only for the following 2problems.
Use Method 1 and Method 2 for each problem.
Method 1 code:
a = 1/3;
d2d = 2;
stock = 1;
deliv = -1;
totalsold = 0;
totallost = 0;
totalcust = 0;
numweeks = 10;
For[i = 1, i <= numweeks, i++,
(
For[j = 1, j <= 7, j++,
(
sold = 0;
lost = 0;
If[deliv == 0,
stock++;];
If[deliv >= 0,
deliv–;];
randomnum = Random[Real, {0, 1}, 5];
If[randomnum < a,
customers = 1;,
customers = 0];
If[customers == 1,
(
If[stock > 0,
(
sold++;
stock–;
If[deliv < 0,
deliv = d2d;];
),
lost++];
)];
totalsold = totalsold + sold;
totallost = totallost + lost;
totalcust = totalcust + customers;
)];
)];
Print[“total sold = “, totalsold];
Print[“total customers = “, totalcust];
Print[“total customers lost = “, totallost];
Method 2 code:
a
PayPal Gateway not configured
PayPal Gateway not configured