" + m1 + m2 + m3 + e2 + "

" + m1 + m2 + m3 + e3 + "

" + m1 + m2 + m3 + e4 + "

" Je1="" JEquationText%QUESTION.NUMBER% = m1 + m2 + m3 + Je1 document.write(QuestionText%QUESTION.NUMBER%); document.write("") document.write("

"+""+"

") } // Template updated and developed by Daniel Nichols & Martin Greenhow, Brunel University, July 2004, working // on original templates authored by Dominic Smith of Brunel University, July 2001, with // valuable contributions from Professor David Hewitt of Monash University, Australia. ]]>

"} else { if (document.forms[0].elements[item].value==DISA) {document.forms[0].elements[item+3].value = "Your answer, "+document.forms[0].elements[item].value+", isn't correct. It should have been "+COR+".

"+ANS_DISA+"

"+SHOW+" "} else { if (document.forms[0].elements[item].value==DISB) {document.forms[0].elements[item+3].value = "Your answer, "+document.forms[0].elements[item].value+", is incorrect. It should have been "+COR+".

"+ANS_DISB+"

"+SHOW+" "} else {document.forms[0].elements[item+3].value = "Your answer "+document.forms[0].elements[item].value+", ought to have been "+COR+".

"} }} document.forms[0].elements[item+3].value = QT + "The feasible region (shown yellow in the graph) is given by

" + EquationText%QUESTION.NUMBER% + "and the objective function *J* (shown maximised by a white line in the graph) is given by

" + JEquationText%QUESTION.NUMBER% + "

" + SVG_plot%QUESTION.NUMBER% + "

The optimum point is where the white line touches the yellow region. "+degenerate_message+"

" + document.forms[0].elements[item+3].value } function question%QUESTION.NUMBER%() { currencyarray = new Array("¥","£","$","€"); currencyindex = Math.ceil(currencyarray.length*Math.random())-1; currency = currencyarray[currencyindex%currencyarray.length]; currency_small_array = new Array(" cents"," pence"," cents"," cents"); currency_small = currency_small_array[currencyindex%currencyarray.length]; scenario = Math.ceil(7*Math.random())-1; // this bit allows sensible numbers in scenarios scenario_objective_factor = 1; if(scenario == 2)scenario_objective_factor = 100; if(scenario == 3)scenario_objective_factor = 100; if(scenario == 4)scenario_objective_factor = 10; if(scenario == 5)scenario_objective_factor = 30/100; myNumArray = displayarray( 3, 2, 10 , 0); sorted = jSort(myNumArray,0,2,0) y0 = sorted[0]; y1 = sorted[1]; y2 = sorted[2]+1; myNumArray = displayarray( 1, 1, 2 , 0); x0 = myNumArray[0]*(y2-y0); myNumArray = displayarray( 1, 2, 5 , 0); factor = myNumArray[0]; myNumArray = displayarray( 1, 2, 5 , 0); mfactor = myNumArray[0]; myNumArray = displayarray( 1, 1, 17 , 0); // this spreads the choices more or less evenly between the 3 feasible points alpha = (myNumArray[0]*0.1).toFixed(2); myNumArray = displayarray( 1, 2, 5 , 0); beta = (myNumArray[0])*0.1; // this allows degeneracy beta = beta.toFixed(2) beta_div_alpha = beta/alpha; if(alpha == 1){display_alpha = ""}else{display_alpha = alpha}; if(beta == 1){display_beta = ""}else{display_beta = beta}; Ji = (scenario_objective_factor*beta*y2*x0/(y2-y0)).toFixed(2); Jii = (scenario_objective_factor*alpha*y0+scenario_objective_factor*beta*x0).toFixed(2); Jiii = (scenario_objective_factor*alpha*y1).toFixed(2); if(beta_div_alpha < (y1-y0)/x0){degenerate%QUESTION.NUMBER% = "no"; point%QUESTION.NUMBER% = "iii"; Correct%QUESTION.NUMBER% = Jiii; Distractor1%QUESTION.NUMBER% = Ji; Distractor2%QUESTION.NUMBER% = Jii;} if(beta_div_alpha == (y1-y0)/x0){degenerate%QUESTION.NUMBER% = "yes"; point%QUESTION.NUMBER% = "iii degenerate"; Correct%QUESTION.NUMBER% = Jiii; Distractor1%QUESTION.NUMBER% = Ji; Distractor2%QUESTION.NUMBER% = Jii;} if(beta_div_alpha > (y1-y0)/x0 && beta_div_alpha<(y2-y0)/x0){degenerate%QUESTION.NUMBER% = "no"; point%QUESTION.NUMBER% = "ii"; Correct%QUESTION.NUMBER% = Jii; Distractor1%QUESTION.NUMBER% = Jiii; Distractor2%QUESTION.NUMBER% = Ji;} if(beta_div_alpha == (y2-y0)/x0){degenerate%QUESTION.NUMBER% = "yes"; point%QUESTION.NUMBER% = "ii degenerate"; Correct%QUESTION.NUMBER% = Jii; Distractor1%QUESTION.NUMBER% = Jiii; Distractor2%QUESTION.NUMBER% = Ji;} if(beta_div_alpha > (y2-y0)/x0){degenerate%QUESTION.NUMBER% = "no"; point%QUESTION.NUMBER% = "i"; Correct%QUESTION.NUMBER% = Ji; Distractor1%QUESTION.NUMBER% = Jii; Distractor2%QUESTION.NUMBER% = Jiii;} extra_feedback%QUESTION.NUMBER% = "

";
if(scenario == 0){
y = "M";
x = "D";
sex = Math.ceil(2*Math.random());
// NB Parent is a reserved word - hence pParent etc
if(sex == 1){pParent = "Father"; pparent = "father"}else{pParent = "Mother"; pparent = "mother"};
QuestionText%QUESTION.NUMBER% = "English Antarctican Tobacco decides to produce a "+pParent+"\&\#39s Day gift pack containing *M* Macbeth cigars and *D* Director cigarettes.

Macbeths cost "+x0+"p to package and Directors cost "+(y1-y0)+"p to package. Total packaging costs are limited to "+x0*y1+"p.

Macbeths cost "+factor*x0+"p to produce and Directors cost "+factor*(y2-y0)+"p to produce. Total production costs are limited to "+factor*x0*y2+"p per gift pack.

"
QuestionText%QUESTION.NUMBER% += "The government charges tax at the following rates: "+display_alpha+"p per Macbeth and "+display_beta+"p per Director.

What is the maximum tax in pence that the government can collect per gift pack?

"
extra_feedback%QUESTION.NUMBER% += "Did you know that around 50% (yes half!) of young adults that smoke will die of smoking-related causes? In the UK this is usually lung cancer: in China it is emphysema.";
}
if(scenario == 1){
y = "M";
x = "D";
sex = Math.ceil(2*Math.random());
// NB Parent is a reserved word - hence pParent etc
if(sex == 1){pParent = "Father"; pparent = "father"}else{pParent = "Mother"; pparent = "mother"};
QuestionText%QUESTION.NUMBER% = "English Antarctican Tobacco decides to produce a "+pParent+"\&\#39s Day gift pack (for purchase by children that do not like their "+pparent+"s much!) containing *M* Macbeth cigars and *D* Director cigarettes.

Macbeths cost "+x0+"p to package and Directors cost "+(y1-y0)+"p to package. Total packaging costs are limited to "+x0*y1+"p.

Macbeths cost "+factor*x0+"p to produce and Directors cost "+factor*(y2-y0)+"p to produce. Total production costs are limited to "+factor*x0*y2+"p per gift pack.

"
QuestionText%QUESTION.NUMBER% += "It is known that the expected number of additional addictions per year per 1000 gift pack sales depends on the number of Macbeths and Directors in each gift pack. From Macbeths it is "+display_alpha+"*M* and from Directors it is "+display_beta+"*D*.

The company arranges its production to maximise the number of additional addictions. What is the expected number of addictions per year per 1000 gift pack sales?

" extra_feedback%QUESTION.NUMBER% += "Did you know that around 50% (yes half!) of young adults that smoke will die of smoking-related causes? In the UK this is usually lung cancer: in China it is emphysema."; } if(scenario == 2){ itemsoldarray = new Array("camera","printer","television","DVD player","hard drive","flash drive","notebook PC","video camera","mobile phone"); itemsoldindex = Math.ceil(itemsoldarray.length*Math.random())-1; itemsold1 = itemsoldarray[itemsoldindex%itemsoldarray.length]; more = Math.ceil(Math.random()*(itemsoldarray.length-1)); itemsoldindex +=more; itemsold2 = itemsoldarray[itemsoldindex%itemsoldarray.length]; // do not delete this comment! y = itemsold1.substring(0,1); x = itemsold2.substring(0,1); factor = factor*10; QuestionText%QUESTION.NUMBER% = "An electronics company produces "+itemsold1+"s ("+y+") and "+itemsold2+"s ("+x+"). Demand exceeds production for both products. Individual item costs are as follows:

- "+itemsold1+"s cost "+currency+x0+" to package and "+itemsold2+"s cost "+currency+(y1-y0)+" to package. Total packaging costs are limited to "+currency+x0*y1+" per batch.
- "+itemsold1+"s cost "+currency+factor*x0+" to produce and "+itemsold2+"s cost "+currency+factor*(y2-y0)+" to produce. Total production costs are limited to "+currency+factor*x0*y2+" per batch.

"
QuestionText%QUESTION.NUMBER% += "The profit for each product is: "+currency+(scenario_objective_factor*alpha).toFixed(2)+" per "+itemsold1+" and "+currency+(scenario_objective_factor*beta).toFixed(2)+" per "+itemsold2+".

What is the maximum profit per batch?

" } if(scenario == 3){ itemsoldarray = new Array("camera","printer","television","DVD player","hard drive","flash drive","notebook PC","video camera","mobile phone"); itemsoldindex = Math.ceil(itemsoldarray.length*Math.random())-1; itemsold1 = itemsoldarray[itemsoldindex%itemsoldarray.length]; more = Math.ceil(Math.random()*(itemsoldarray.length-1)); itemsoldindex +=more; itemsold2 = itemsoldarray[itemsoldindex%itemsoldarray.length]; // do not delete this comment! y = itemsold1.substring(0,1); x = itemsold2.substring(0,1); // factor = factor*10; QuestionText%QUESTION.NUMBER% = "An electronics company produces "+itemsold1+"s ("+y+") and "+itemsold2+"s ("+x+"). Demand exceeds production for both products. Individual item times are as follows:

- "+itemsold1+"s take "+x0+" minutes to package and "+itemsold2+"s take "+(y1-y0)+" minutes to package. Total packaging minutes are limited to "+x0*y1+" per packer.
- "+itemsold1+"s take "+factor*x0+" hours to produce and "+itemsold2+"s take "+factor*(y2-y0)+" hours to produce. Total production hours are limited to "+factor*x0*y2+" per robot.

"
QuestionText%QUESTION.NUMBER% += "The profit for each product is: "+currency+(scenario_objective_factor*alpha).toFixed(2)+" per "+itemsold1+" and "+currency+(scenario_objective_factor*beta).toFixed(2)+" per "+itemsold2+".

What is the maximum profit that one packer and one robot can generate?

" } if(scenario == 4){ itemsoldarray = new Array("wild boar","carribou","hippo","giraffe","zebra","elephant","yak","buffalo","moose"); itemsoldindex = Math.ceil(itemsoldarray.length*Math.random())-1; itemsold1 = itemsoldarray[itemsoldindex%itemsoldarray.length]; more = Math.ceil(Math.random()*(itemsoldarray.length-1)); itemsoldindex +=more; itemsold2 = itemsoldarray[itemsoldindex%itemsoldarray.length]; // do not delete this comment! y = itemsold1.substring(0,1); x = itemsold2.substring(0,1); // factor = factor*10; QuestionText%QUESTION.NUMBER% = "An zoo keeps "+itemsold1+"s ("+y+") and "+itemsold2+"s ("+x+"). Individual animal overheads are as follows:

- "+itemsold1+"s use "+x0+" tonnes of bedding per month and "+itemsold2+"s use "+(y1-y0)+" tonnes of bedding per month. Total bedding tonnage is limited to "+x0*y1+" per month.
- "+itemsold1+"s eat "+factor*x0+" tonnes of food per year and "+itemsold2+"s eat "+factor*(y2-y0)+" tonnes of food per year. Total food tonnage is limited to "+factor*x0*y2+" per year.

"
QuestionText%QUESTION.NUMBER% += "Average visitor times (person minutes per day) for each animal type are: "+(scenario_objective_factor*alpha).toFixed(2)+" minutes per "+itemsold1+" and "+(scenario_objective_factor*beta).toFixed(2)+" minutes per "+itemsold2+".

What is the maximum visitor person minutes per day for both animal enclosures?

"
}
if(scenario == 5){
y = "*P _{A}* being in group A and

- Drug A costs "+currency+x0+",000 per course and drug B costs "+currency+(y1-y0)+",000 per course. Total drug cost is limited to "+currency+x0*y1+",000.
- Drug A takes "+factor*x0+" days in hospital and drug B takes "+factor*(y2-y0)+" days in hospital. The total days in hospital is limited to "+factor*x0*y2+".

"
QuestionText%QUESTION.NUMBER% += "Average recovery rates for each treatment are: "+(scenario_objective_factor*alpha*100).toFixed(2)+" % for group A and "+(scenario_objective_factor*beta*100).toFixed(2)+" % for group B.

What is the maximum expected number of patients that will recover if the health authority uses its resources properly?

"
}
if(scenario == 6){
itemsoldarray = new Array("Wild Boar Associates","Carribou & Mutual","Hippo International","Giraffe Conglomerates","Zebra (Europe) AS","Elephants Unlimited","Yak & General","Buffalo Transamerican","Moose Holdings PLC");
itemsoldindex = Math.ceil(itemsoldarray.length*Math.random())-1;
itemsold1 = itemsoldarray[itemsoldindex%itemsoldarray.length];
more = Math.ceil(Math.random()*(itemsoldarray.length-1));
itemsoldindex +=more;
itemsold2 = itemsoldarray[itemsoldindex%itemsoldarray.length];
// do not delete this comment!
y = "*"+itemsold1.substring(0,1)+"*";
x = "*"+itemsold2.substring(0,1)+"*";
// factor = factor/100;
QuestionText%QUESTION.NUMBER% = "A city trader is considering selling unit trusts comprising "+y+" shares in "+itemsold1+" and "+x+" shares in "+itemsold2+". Costs are as follows:

- "+itemsold1+" shares cost "+currency+x0+" each and "+itemsold2+" shares cost "+currency+(y1-y0)+" each. Research has shown that the maximum amount an investor is willing to invest per unit trust is "+currency+x0*y1+".
- There are also financial agent charges per unit trust as follows: "+itemsold1+" shares cost "+factor*x0+currency_small+" each to buy and "+itemsold2+" shares cost "+factor*(y2-y0)+currency_small+" each to buy. Total financial agent charges are limited to "+factor*x0*y2+currency_small+" per unit trust.

"
QuestionText%QUESTION.NUMBER% += "The expected profit for each share is: "+currency+(scenario_objective_factor*alpha).toFixed(2)+" for "+itemsold1+" and "+currency+(scenario_objective_factor*beta).toFixed(2)+" for "+itemsold2+".

What is the maximum expected profit that one unit trust can generate?

"
y = itemsold1.substring(0,1);
x = itemsold2.substring(0,1);
}
// Using anonymous functions...
// var colours = new Array("black","red","white","blue","cyan");
var mfuncs = new Array();
mfuncs[0] = function (x) {return ((y0-y1)/x0)*x+y1; };
mfuncs[1] = function (x) {return ((y0-y2)/x0)*x+y2; };
mfuncs[2] = function (x) {return 0; };
mfuncs[3] = function (x) {if(x <= 0){return y2}else{return 0} };
mfuncs[4] = function (x) {return (-beta/alpha)*x+Correct%QUESTION.NUMBER%/(alpha*scenario_objective_factor); };
// Notice functions have no name.
// x1 = Math.min(Math.ceil(y1*x0/(y1-y0)),x0*2);
x1 = Math.ceil(y1*x0/(y1-y0));
neg_x = -Math.ceil(x1/10)
neg_y = -Math.ceil(y2/10)
var math_params = new Array(neg_x,x1,neg_y,y2);
var axes_labels = new Array(x,y);
SVG_plot%QUESTION.NUMBER% = questionSVG(mfuncs,math_params,axes_labels);
var coeffs1 = new Array();
coeffs1[0]=0;
coeffs1[1]=x0;
coeffs1[2]=y1-y0;
var coeffs2 = new Array();
coeffs2[0]=0;
coeffs2[1]=factor*x0;
coeffs2[2]=factor*(y2-y0);
var coeffsJ = new Array();
coeffsJ[0]=0;
if(scenario == 5){
coeffsJ[1]=(scenario_objective_factor*alpha).toFixed(4);
coeffsJ[2]=(scenario_objective_factor*beta).toFixed(4);
}else{
coeffsJ[1]=(scenario_objective_factor*alpha).toFixed(2);
coeffsJ[2]=(scenario_objective_factor*beta).toFixed(2);
}
Nwidth=getFontSize()/16*500
Nheight=getFontSize()/16*60
m1="

" + m1 + m2 + m3 + e2 + "

" + m1 + m2 + m3 + e3 + "

" + m1 + m2 + m3 + e4 + "

" Je1="" JEquationText%QUESTION.NUMBER% = m1 + m2 + m3 + Je1 if(degenerate%QUESTION.NUMBER% == "yes")QuestionText%QUESTION.NUMBER% +="

**Hint: this example, whilst perfectly valid, is degenerate!**

"
document.write(QuestionText%QUESTION.NUMBER%);
document.write("")
document.write("*Input your answer correct to 2 decimal places.*")
document.write("")
}
function questionSVG(mfuncs,math_params,axes_labels){
var svg_params = new Array(0,200,0,200);
var xcoords = new Array(math_params[1]/2,math_params[2]/2);
var ycoords = new Array(math_params[0]/2,math_params[3]/2);
fontscale = 1/2;
xgrid_space = -math_params[0];
ygrid_space = -math_params[2];
var grid = new Array(xgrid_space,ygrid_space,getFgColor()); // Array determines properties of the grid.
var padding = new Array(0.05,0.1); // Array determines proportion of graph sacraficed for padding (outer border,middle area), eg 0.5 => 50%
var ns = "iSvg";
var funcs = new Array(); // Array of functions to be plotted,
//Function,Stroke,Fill,Line thickness,Opacity,Shade area below line ;false=>shade area above line
funcs[0]= new Array(mfuncs[0],"blue","blue",1,0.6,false);
funcs[1]= new Array(mfuncs[1],"red","red",1,0.6,false);
funcs[2]= new Array(mfuncs[2],"black","grey",1,0.,true);
funcs[3]= new Array(mfuncs[3],"black","grey",1,0.8,true);
funcs[4]= new Array(mfuncs[4],"white","grey",1,0,true);
var colours = new Array("yellow","white","cyan"); // Colours used in graph (main background,inner padded background, border).
var code = svg_graph(funcs,math_params,svg_params,ns,200,grid,padding,colours,xcoords,ycoords,axes_labels,fontscale);
Nwidth=getFontSize()/16*500
Nheight=getFontSize()/16*600
Nwidthvb=getFontSize()/16*280
Nheightvb=getFontSize()/16*280
Nwidthvb=200
Nheightvb=200
return "<"+ns+":svg width="+Nwidth+" height="+Nheight+" viewBox='0 0 "+Nwidthvb+" "+Nheightvb+"'>

"+""+"

") } // Template updated and developed by Daniel Nichols & Martin greenhow, Brunel University, July 2004, working // on original templates authored by Dominic Smith of Brunel University, July 2001, with // valuable contributions from Professor David Hewitt of Monash University, Australia. ]]>

"} else {if (document.forms[0].elements[item-1].value==COR1 || document.forms[0].elements[item].value==COR2 ) {document.forms[0].elements[item+3].value = "You got one value right, but to get any marks you need both! "+COR2+" and "+COR1+", were required.

"+ANS+"

"+SHOW+"

" } else {if (document.forms[0].elements[item-1].value!=COR1 && document.forms[0].elements[item].value!=COR2 ) {document.forms[0].elements[item+3].value = "Your answers were wrong. The correct answers were "+COR2+" and "+COR1+".

"+ANS+"

"+SHOW+"

" } } } document.forms[0].elements[item+3].value = QT + "The feasible region (shown yellow in the graph) is given by

" + EquationText%QUESTION.NUMBER% + "and the objective function *J* (shown maximised by a white line in the graph) is given by

" + JEquationText%QUESTION.NUMBER% + "

" + SVG_plot%QUESTION.NUMBER% + "

The optimum point is where the white line touches the yellow region. "+point%QUESTION.NUMBER%+" Although not asked for, the value of *J* at this point is "+COR+"

" + document.forms[0].elements[item+3].value +extra_feedback%QUESTION.NUMBER%; } function question%QUESTION.NUMBER%() { currencyarray = new Array("¥","£","$","€"); currencyindex = Math.ceil(currencyarray.length*Math.random())-1; currency = currencyarray[currencyindex%currencyarray.length]; currency_small_array = new Array(" cents"," pence"," cents"," cents"); currency_small = currency_small_array[currencyindex%currencyarray.length]; scenario = Math.ceil(7*Math.random())-1; // scenario = 5; // this bit allows sensible numbers in scenarios scenario_objective_factor = 1; if(scenario == 2)scenario_objective_factor = 100; if(scenario == 3)scenario_objective_factor = 100; if(scenario == 4)scenario_objective_factor = 10; if(scenario == 5)scenario_objective_factor = 30/100; myNumArray = displayarray( 3, 2, 10 , 0); sorted = jSort(myNumArray,0,2,0) y0 = sorted[0]; y1 = sorted[1]; y2 = sorted[2]+1; myNumArray = displayarray( 1, 1, 2 , 0); x0 = myNumArray[0]*(y2-y0); myNumArray = displayarray( 1, 2, 5 , 0); factor = myNumArray[0]; myNumArray = displayarray( 1, 2, 5 , 0); mfactor = myNumArray[0]; myNumArray = displayarray( 1, 1, 17 , 0); // this spreads the choices more or less evenly between the 3 feasible points alpha = (myNumArray[0]*0.1).toFixed(2); myNumArray = displayarray( 1, 2, 5 , 0); beta = (myNumArray[0]-0.1)*0.1; // this avoids degeneracy beta = beta.toFixed(2) beta_div_alpha = beta/alpha; if(alpha == 1){display_alpha = ""}else{display_alpha = alpha}; if(beta == 1){display_beta = ""}else{display_beta = beta}; Ji = (scenario_objective_factor*beta*y2*x0/(y2-y0)).toFixed(2); Jii = (scenario_objective_factor*alpha*y0+scenario_objective_factor*beta*x0).toFixed(2); Jiii = (scenario_objective_factor*alpha*y1).toFixed(2); extra_feedback%QUESTION.NUMBER% = "

";
if(scenario == 0){
y = "M";
x = "D";
sex = Math.ceil(2*Math.random());
// NB Parent is a reserved word - hence pParent etc
if(sex == 1){pParent = "Father"; pparent = "father"}else{pParent = "Mother"; pparent = "mother"};
QuestionText%QUESTION.NUMBER% = "English Antarctican Tobacco decides to produce a "+pParent+"\&\#39s Day gift pack containing *M* Macbeth cigars and *D* Director cigarettes.

Macbeths cost "+x0+"p to package and Directors cost "+(y1-y0)+"p to package. Total packaging costs are limited to "+x0*y1+"p.

Macbeths cost "+factor*x0+"p to produce and Directors cost "+factor*(y2-y0)+"p to produce. Total production costs are limited to "+factor*x0*y2+"p per gift pack.

"
QuestionText%QUESTION.NUMBER% += "The government charges tax at the following rates: "+display_alpha+"p per Macbeth and "+display_beta+"p per Director.

What values of *"+x+"* and *"+y+"* give the maximum tax that the government can collect per gift pack?

"
extra_feedback%QUESTION.NUMBER% += "Did you know that around 50% (yes half!) of young adults that smoke will die of smoking-related causes? In the UK this is usually lung cancer: in China it is emphysema.";
}
if(scenario == 1){
y = "M";
x = "D";
sex = Math.ceil(2*Math.random());
// NB Parent is a reserved word - hence pParent etc
if(sex == 1){pParent = "Father"; pparent = "father"}else{pParent = "Mother"; pparent = "mother"};
QuestionText%QUESTION.NUMBER% = "English Antarctican Tobacco decides to produce a "+pParent+"\&\#39s Day gift pack (for purchase by children that do not like their "+pparent+"s much!) containing *M* Macbeth cigars and *D* Director cigarettes.

Macbeths cost "+x0+"p to package and Directors cost "+(y1-y0)+"p to package. Total packaging costs are limited to "+x0*y1+"p.

Macbeths cost "+factor*x0+"p to produce and Directors cost "+factor*(y2-y0)+"p to produce. Total production costs are limited to "+factor*x0*y2+"p per gift pack.

"
QuestionText%QUESTION.NUMBER% += "It is known that the expected number of additional addictions per year per 1000 gift pack sales depends on the number of Macbeths and Directors in each gift pack. From Macbeths it is "+display_alpha+"*M* and from Directors it is "+display_beta+"*D*.

The company arranges its production to maximise the number of additional addictions. What values of *"+x+"* and *"+y+"* should the company choose?

" extra_feedback%QUESTION.NUMBER% += "Did you know that around 50% (yes half!) of young adults that smoke will die of smoking-related causes? In the UK this is usually lung cancer: in China it is emphysema."; } if(scenario == 2){ itemsoldarray = new Array("camera","printer","television","DVD player","hard drive","flash drive","notebook PC","video camera","mobile phone"); itemsoldindex = Math.ceil(itemsoldarray.length*Math.random())-1; itemsold1 = itemsoldarray[itemsoldindex%itemsoldarray.length]; more = Math.ceil(Math.random()*(itemsoldarray.length-1)); itemsoldindex +=more; itemsold2 = itemsoldarray[itemsoldindex%itemsoldarray.length]; // do not delete this comment! y = itemsold1.substring(0,1); x = itemsold2.substring(0,1); factor = factor*10; QuestionText%QUESTION.NUMBER% = "An electronics company produces "+itemsold1+"s ("+y+") and "+itemsold2+"s ("+x+"). Demand exceeds production for both products. Individual item costs are as follows:

- "+itemsold1+"s cost "+currency+x0+" to package and "+itemsold2+"s cost "+currency+(y1-y0)+" to package. Total packaging costs are limited to "+currency+x0*y1+" per batch.
- "+itemsold1+"s cost "+currency+factor*x0+" to produce and "+itemsold2+"s cost "+currency+factor*(y2-y0)+" to produce. Total production costs are limited to "+currency+factor*x0*y2+" per batch.

"
QuestionText%QUESTION.NUMBER% += "The profit for each product is: "+currency+(scenario_objective_factor*alpha).toFixed(2)+" per "+itemsold1+" and "+currency+(scenario_objective_factor*beta).toFixed(2)+" per "+itemsold2+".

What values of *"+x+"* and *"+y+"* should the company choose to maximise the profit per batch?

" } if(scenario == 3){ itemsoldarray = new Array("camera","printer","television","DVD player","hard drive","flash drive","notebook PC","video camera","mobile phone"); itemsoldindex = Math.ceil(itemsoldarray.length*Math.random())-1; itemsold1 = itemsoldarray[itemsoldindex%itemsoldarray.length]; more = Math.ceil(Math.random()*(itemsoldarray.length-1)); itemsoldindex +=more; itemsold2 = itemsoldarray[itemsoldindex%itemsoldarray.length]; // do not delete this comment! y = itemsold1.substring(0,1); x = itemsold2.substring(0,1); // factor = factor*10; QuestionText%QUESTION.NUMBER% = "An electronics company produces "+itemsold1+"s ("+y+") and "+itemsold2+"s ("+x+"). Demand exceeds production for both products. Individual item times are as follows:

- "+itemsold1+"s take "+x0+" minutes to package and "+itemsold2+"s take "+(y1-y0)+" minutes to package. Total packaging minutes are limited to "+x0*y1+" per packer.
- "+itemsold1+"s take "+factor*x0+" hours to produce and "+itemsold2+"s take "+factor*(y2-y0)+" hours to produce. Total production hours are limited to "+factor*x0*y2+" per robot.

"
QuestionText%QUESTION.NUMBER% += "The profit for each product is: "+currency+(scenario_objective_factor*alpha).toFixed(2)+" per "+itemsold1+" and "+currency+(scenario_objective_factor*beta).toFixed(2)+" per "+itemsold2+".

What values of *"+x+"* and *"+y+"* should the company choose to maximise the profit that one packer and one robot can generate?

" } if(scenario == 4){ itemsoldarray = new Array("wild boar","carribou","hippo","giraffe","zebra","elephant","yak","buffalo","moose"); itemsoldindex = Math.ceil(itemsoldarray.length*Math.random())-1; itemsold1 = itemsoldarray[itemsoldindex%itemsoldarray.length]; more = Math.ceil(Math.random()*(itemsoldarray.length-1)); itemsoldindex +=more; itemsold2 = itemsoldarray[itemsoldindex%itemsoldarray.length]; // do not delete this comment! y = itemsold1.substring(0,1); x = itemsold2.substring(0,1); // factor = factor*10; QuestionText%QUESTION.NUMBER% = "An zoo keeps "+y+" "+itemsold1+"s and "+x+" "+itemsold2+"s. Individual animal overheads are as follows:

- "+itemsold1+"s use "+x0+" tonnes of bedding per month and "+itemsold2+"s use "+(y1-y0)+" tonnes of bedding per month. Total bedding tonnage is limited to "+x0*y1+" per month.
- "+itemsold1+"s eat "+factor*x0+" tonnes of food per year and "+itemsold2+"s eat "+factor*(y2-y0)+" tonnes of food per year. Total food tonnage is limited to "+factor*x0*y2+" per year.

"
QuestionText%QUESTION.NUMBER% += "Average visitor times (person minutes per day) for each animal type are: "+(scenario_objective_factor*alpha).toFixed(2)+" minutes per "+itemsold1+" and "+(scenario_objective_factor*beta).toFixed(2)+" minutes per "+itemsold2+".

What values of *"+x+"* and *"+y+"* should the zoo choose to maximise the visitor person minutes per day for both animal enclosures?

"
}
if(scenario == 5){
y = "*N _{A}* being in group A and

- Drug A costs "+currency+x0+",000 per course and drug B costs "+currency+(y1-y0)+",000 per course. Total drug cost is limited to "+currency+x0*y1+",000.
- Drug A takes "+factor*x0+" days in hospital and drug B takes "+factor*(y2-y0)+" days in hospital. The total days in hospital is limited to "+factor*x0*y2+".

"
QuestionText%QUESTION.NUMBER% += "Average recovery rates for each treatment are: "+(scenario_objective_factor*alpha*100).toFixed(2)+"% for group A and "+(scenario_objective_factor*beta*100).toFixed(2)+"% for group B.

What values of *N _{A}* (=NA) and

"
}
if(scenario == 6){
itemsoldarray = new Array("Wild Boar Associates","Carribou & Mutual","Hippo International","Giraffe Conglomerates","Zebra (Europe) AS","Elephants Unlimited","Yak & General","Buffalo Transamerican","Moose Holdings PLC");
itemsoldindex = Math.ceil(itemsoldarray.length*Math.random())-1;
itemsold1 = itemsoldarray[itemsoldindex%itemsoldarray.length];
more = Math.ceil(Math.random()*(itemsoldarray.length-1));
itemsoldindex +=more;
itemsold2 = itemsoldarray[itemsoldindex%itemsoldarray.length];
// do not delete this comment!
y = "*"+itemsold1.substring(0,1)+"*";
x = "*"+itemsold2.substring(0,1)+"*";
// factor = factor/100;
QuestionText%QUESTION.NUMBER% = "A city trader is considering selling unit trusts comprising "+y+" shares in "+itemsold1+" and "+x+" shares in "+itemsold2+". Costs are as follows:

- "+itemsold1+" shares cost "+currency+x0+" each and "+itemsold2+" shares cost "+currency+(y1-y0)+" each. Research has shown that the maximum amount an investor is willing to invest per unit trust is "+currency+x0*y1+".
- There are also financial agent charges per unit trust as follows: "+itemsold1+" shares cost "+factor*x0+currency_small+" each to buy and "+itemsold2+" shares cost "+factor*(y2-y0)+currency_small+" each to buy. Total financial agent charges are limited to "+factor*x0*y2+currency_small+" per unit trust.

"
QuestionText%QUESTION.NUMBER% += "The expected profit for each share is: "+currency+(scenario_objective_factor*alpha).toFixed(2)+" for "+itemsold1+" and "+currency+(scenario_objective_factor*beta).toFixed(2)+" for "+itemsold2+".

What values of *"+x+"* and *"+y+"* should the city trader choose to maximise the expected profit that one unit trust can generate?

"
y = itemsold1.substring(0,1);
x = itemsold2.substring(0,1);
}
if(beta_div_alpha<=(y1-y0)/x0){point%QUESTION.NUMBER% = "This happens when "+y+" = "+y1+" and "+x+" = 0."; Correct%QUESTION.NUMBER% = Jiii; Correct2%QUESTION.NUMBER% = y1; Correct1%QUESTION.NUMBER% = 0;}
if(beta_div_alpha>(y1-y0)/x0 && beta_div_alpha<=(y2-y0)/x0){point%QUESTION.NUMBER% = "This happens when "+y+" = "+y0+" and "+x+" = "+x0+"."; Correct%QUESTION.NUMBER% = Jii; Correct2%QUESTION.NUMBER% = y0; Correct1%QUESTION.NUMBER% = x0;}
if(beta_div_alpha>(y2-y0)/x0){point%QUESTION.NUMBER% = "This happens when "+y+" = 0 and "+x+" = "+y2*x0/(y2-y0)+"."; Correct%QUESTION.NUMBER% = Ji; Correct2%QUESTION.NUMBER% = 0; Correct1%QUESTION.NUMBER% = y2*x0/(y2-y0);}
// Using anonymous functions...
// var colours = new Array("black","red","white","blue","cyan");
var mfuncs = new Array();
mfuncs[0] = function (x) {return ((y0-y1)/x0)*x+y1; };
mfuncs[1] = function (x) {return ((y0-y2)/x0)*x+y2; };
mfuncs[2] = function (x) {return 0; };
mfuncs[3] = function (x) {if(x <= 0){return y2}else{return 0} };
mfuncs[4] = function (x) {return (-beta/alpha)*x+Correct%QUESTION.NUMBER%/(alpha*scenario_objective_factor); };
// Notice functions have no name.
// x1 = Math.min(Math.ceil(y1*x0/(y1-y0)),x0*2);
x1 = Math.ceil(y1*x0/(y1-y0));
neg_x = -Math.ceil(x1/10)
neg_y = -Math.ceil(y2/10)
var math_params = new Array(neg_x,x1,neg_y,y2);
var axes_labels = new Array(x,y);
SVG_plot%QUESTION.NUMBER% = questionSVG(mfuncs,math_params,axes_labels);
var coeffs1 = new Array();
coeffs1[0]=0;
coeffs1[1]=x0;
coeffs1[2]=y1-y0;
var coeffs2 = new Array();
coeffs2[0]=0;
coeffs2[1]=factor*x0;
coeffs2[2]=factor*(y2-y0);
var coeffsJ = new Array();
coeffsJ[0]=0;
if(scenario == 5){
coeffsJ[1]=(scenario_objective_factor*alpha).toFixed(4);
coeffsJ[2]=(scenario_objective_factor*beta).toFixed(4);
}else{
coeffsJ[1]=(scenario_objective_factor*alpha).toFixed(2);
coeffsJ[2]=(scenario_objective_factor*beta).toFixed(2);
}
Nwidth=getFontSize()/16*500
Nheight=getFontSize()/16*60
m1="

" + m1 + m2 + m3 + e2 + "

" + m1 + m2 + m3 + e3 + "

" + m1 + m2 + m3 + e4 + "

" Je1="" JEquationText%QUESTION.NUMBER% = m1 + m2 + m3 + Je1 // document.write(Correct%QUESTION.NUMBER%+"

"+Correct2%QUESTION.NUMBER%+"

"+Correct1%QUESTION.NUMBER%+"

") document.write(QuestionText%QUESTION.NUMBER%); document.write(x + " = "); document.write(""); document.write(y + " = "); document.write(""); document.write("

"+""+"

") } // Template updated and developed by Daniel Nichols & Martin greenhow, Brunel University, July 2004, working // on original templates authored by Dominic Smith of Brunel University, July 2001, with // valuable contributions from Professor David Hewitt of Monash University, Australia. ]]>