function ch1p1(h)
{

var qnum=1;

var answer;
var errorpcnt=0.02; // this is the allowable percentage error
range[h]=errorpcnt;
var i,j;
var amount1str,amount2str;

var index1=Math.floor(3.99*Math.random());

unit=new Array(4);
prefix=new Array(10);
prefix_html=new Array(10);
conversion=new Array(10);
prefix_name=new Array(10);
unit_name=new Array(4);

index1=Math.floor(7.99*Math.random());
index2=Math.floor(3.99*Math.random());
index3=Math.floor(7.99*Math.random());

unit[0]="m";unit_name[0]="meters";
unit[1]="L";unit_name[1]="liters";
unit[2]="s";unit_name[2]="seconds";
unit[3]="g";unit_name[3]="grams";

prefix[0]="p";prefix_html[0]=prefix[0];prefix_name[0]="pico";
prefix[1]="n";prefix_html[1]=prefix[1];prefix_name[1]="nano";
prefix[2]="u";prefix_html[2]="&#181;";prefix_name[2]="micro";
prefix[3]="m";prefix_html[3]=prefix[3];prefix_name[3]="milli";
prefix[4]="k";prefix_html[4]=prefix[4];prefix_name[4]="kilo";
prefix[5]="M";prefix_html[5]=prefix[5];prefix_name[5]="mega";
prefix[6]="G";prefix_html[6]=prefix[6];prefix_name[6]="giga";
prefix[7]="";prefix_html[7]=prefix[7];prefix_name[7]="";


conversion[0]=1.0e-12;
conversion[1]=1.0e-9;
conversion[2]=1.0e-6;
conversion[3]=1.0e-3;
conversion[4]=1.0e3;
conversion[5]=1.0e6;
conversion[6]=1.0e9;
conversion[7]=1;

amount1=1000.0*Math.random();
amount1=roundit(amount1,3);

amount2=Math.floor(22*Math.random() );
amount2=amount2-10;
amount2=roundit(amount2,3);

amount4=amount1*Math.pow(10,amount2);
amount1=amount4;
amount1=roundit(amount1,3);

amount1str=amount1+"";
amount2str=amount1+"";

i=amount1str.indexOf("e");
j=amount2str.length;
if (  (i>0)&&(i<j) )
	{
	amount1str=roundit(amount1,3);	
	statement[qnum]="How many "+
		prefix_name[index1]+unit_name[index2]+
		" are there in "+amount1str+" "+prefix[index3]+unit[index2]+
		"? Answer example 2.72e-3.";
	statement_write[qnum]="How many <font color='#0000FF'>"+
		prefix_name[index1]+unit_name[index2]+
		"</font> are there in <font color='#0000FF'>"+amount1str+" "+prefix_html[index3]+unit[index2]+
		"</font>? <i>Answer example 2.72e-3</i>.";
	}
else
	{
	amount1str=roundit(amount1,3);
	statement[qnum]="How many "+
		prefix_name[index1]+unit_name[index2]+
		" are there in "+amount1str+" "+prefix[index3]+unit[index2]+
		"? Answer example 2.72e-3.";
	statement_write[qnum]="How many <font color='#0000FF'>"+
		prefix_name[index1]+unit_name[index2]+
		"</font> are there in <font color='#0000FF'>"+amount1str+" "+prefix[index3]+unit[index2]+
		"</font>? <i>Answer example 2.72e-3</i>.";
	}
question_type[qnum]="Units and Measurement: ";
question_type_write[qnum]="<strong>Units and Measurement:  </strong>";
//document.write(question_type[qnum]+"<p></p>"+statement[qnum]);

answer=amount1*conversion[index3]/conversion[index1];
answer=roundit(answer,3);
return answer;
}


function ch1p2(h)
{

var qnum=2;

var answer;
var errorpcnt=0.02; // this is the allowable percentage error
range[h]=errorpcnt;

var index1=Math.floor(13.99*Math.random());

chemical=new Array(14);
density=new Array(14);

chemical[0]="Oxygen, ingested through the gills of fish,";
chemical[1]="Hydrogen, the liquid fuel of the space shuttle,";
chemical[2]="Ethanol, a poison intermediate between rubbing alcohol and wood alcohol";
chemical[3]="Benzene, a potent carcinogen,";
chemical[4]="Water, one of the few liquids in the ecosphere,";
chemical[5]="Magnesium, once used in flashbulbs,";
chemical[6]="Sodium chloride, salt, from which the term salary is derived,";
chemical[7]="Aluminum, used in everything from foil to aircraft bodies,";
chemical[8]="Iron, the principal ingredient in reinforcing bars in concrete,";
chemical[9]="Copper, the smelting of which led to the technological revolution known as the Bronze Age,";
chemical[10]="Silver, or argentum (Latin), a good but expensive conductor of electricity,";
chemical[11]="lead, or plumbum (Latin), from which the term plumbing is derived,";
chemical[12]="Mercury, that heavy liquid from which evaporated the vapors that mad Hatters used to breathe ,";
chemical[13]="Gold, the driving force for exploration of the New World,";

density[0]=0.00133;
density[1]=0.000084;
density[2]=0.785;
density[3]=0.880;
density[4]=1.000;
density[5]=1.74;
density[6]=2.16;
density[7]=2.70;
density[8]=7.87;
density[9]=8.96;
density[10]=10.5;
density[11]=11.34;
density[12]=13.6;
density[13]=19.32;

index1=Math.floor(13.99*Math.random() );
amount1=200.0*Math.random();
amount2=amount1/density[index1];
amount1=roundit(amount1,3);
amount2=roundit(amount2,3);

question_type[qnum]="Units and Measurement:  ";
question_type_write[qnum]="<strong>Units and Measurement:  </strong>";

statement[qnum]=chemical[index1]+" has a mass of "+
	 amount1+" g. and a volume of " + amount2 + 
	 " mL.  What is its density in g./mL.? Answer example 2.43 ";
statement_write[qnum]=chemical[index1]+" has a mass of <font color='#0000FF'>"+
	 amount1+" g.</font> and a volume of <font color='#0000FF'>" + amount2 + 
	 " mL.</font>  What is its density in g./mL.? <i>Answer example 2.43 </i>";

//document.write(question_type[qnum]+"<p></p>"+statement[qnum]);

answer=roundit(density[index1],3);
return answer;
}


function ch1p3(h)
{

var qnum=3;

var answer;
var errorpcnt=0.02; // this is the allowable percentage error
range[h]=errorpcnt;1

var index1=Math.floor(3.99*Math.random());
var index2=Math.floor(1.99*Math.random());

chemical=new Array(4);
unit=new Array(2);
density=new Array(4);
conversion=new Array(4);

chemical[0]="Mercury";
chemical[1]="Benzene";
chemical[2]="Bromine";
chemical[3]="Cyclohexane";

density[0]=13.60;
density[1]=0.879;
density[2]=3.12;
density[3]=0.778;

unit[0]="L";
unit[1]="mL";
conversion[0]=1.00;
conversion[1]=0.001;

amount1=300.0*Math.random();
amount1=roundit(amount1,3);

question_type[qnum]="Units and Measurement:  ";
question_type_write[qnum]="<strong>Units and Measurement:  </strong>";

statement[qnum]="The density of "+chemical[index1]+ " is " +density[index1]+
	" g/mL.  What is the mass in g. of " +amount1+
	" " +unit[index2]+
	" of "+chemical[index1]+"? Answer example is 45.3 ";
statement_write[qnum]="The density of "+chemical[index1]+ " is <font color='#0000FF'>" +density[index1]+
	" g/mL.</font>  What is the mass in g. of <font color='#0000FF'>" +amount1+
	" " +unit[index2]+
	"</font> of "+chemical[index1]+"? <i>Answer example is 45.3 </i>";

	
//document.write(question_type[qnum]+"<p></p>"+statement[qnum]);

answer=density[index1]*amount1*1000.0*conversion[index2];
answer=roundit(answer,3);

return answer;
}


function ch1p4(h)
{

var qnum=4;

var answer;
var errorpcnt=0.02; // this is the allowable percentage error
range[h]=errorpcnt;

var index1=Math.floor(3.99*Math.random());
var index2=Math.floor(3.99*Math.random());
var index3=Math.floor(3.99*Math.random());

unit=new Array(4);
conversion=new Array(4);

unit[0]="mm.";
unit[1]="cm.";
unit[2]="in.";
unit[3]="ft.";

conversion[0]=0.10;
conversion[1]=1.0;
conversion[2]=2.54;
conversion[3]=30.48;

amount1=20.0*Math.random();
amount1=roundit(amount1,3);

length1=12.0*Math.random();
length1=roundit(length1,3);
length2=7.5*Math.random();
length2=roundit(length2,3);

question_type[qnum]="Units and Measurement:  Inferring Dimension  ";
question_type_write[qnum]="<strong>Units and Measurement:  Inferring Dimension  </strong>";


statement[qnum]="A piece of aluminum foil measuring "+
		length1 + " " + unit[index1] + " by " + length2 +" "+ unit[index2] +" has a mass of "+
		amount1+" g.  Aluminum has a density of 2.70 g/cc. "+
		"What is the thickness of the foil in "+
		 unit[index3]+ "?  Answer example is 4.31e-3 or 2.76 ";
statement_write[qnum]="A piece of aluminum foil measuring <font color='#0000FF'>"+
		length1 + " " + unit[index1] + " by " + length2 +" "+ unit[index2] +"</font> has a mass of "+
		amount1+" g. Aluminum has a density of 2.70 g/cc. "+
		"What is the thickness of the foil in <font color='#0000FF'>"+
		 unit[index3]+ "</font>?  <i>Answer example is 4.31e-3 or 2.76 </i>";

//document.write(question_type[qnum]+"<p></p>"+statement[qnum]);

answer=amount1/(2.70*length1*conversion[index1]*length2*conversion[index2]);
answer=answer/conversion[index3];
answer=roundit(answer,3);

return answer;

}


function ch1p5(h)
{

var qnum=5;

var answer;
var errorpcnt=0.02; // this is the allowable percentage error
range[h]=errorpcnt;

var index1=Math.floor(2.99*Math.random());
var index2;
var qualifier;

scale=new Array(4);

do
	{
	index2=Math.floor(2.99*Math.random());
	}
while (index2==index1);

tempref=-20.0+110.0*Math.random();


scale[0]="Celcius";
scale[1]="Fahrenheit";
scale[2]="Kelvin";

if (index1==0) temperature=5.0*(tempref-32.0)/9.0;//make it Celcius
if (index1==2) temperature=(5.0*(tempref-32.0)/9.0)+273.15;//make it Kelvins


if (index2==0)
	{
	temperature_converted=5.0*(tempref-32.0)/9.0;
	if (temperature_converted<10)
		qualifier="chilly";
	else if ((temperature_converted<20)&&(temperature_converted>=10) )
		qualifier="mild";
	else if ((temperature_converted<30)&&(temperature_converted>=20) )
		qualifier="warm";
	else
		qualifier="hot";
	}
if (index2==1)
	{
	temperature_converted=tempref;
	}
if (index2==2)
	{
	temperature_converted=273.15+5.0*(tempref-32.0)/9.0;
	if (temperature_converted<283)
		qualifier="chilly";
	else if ((temperature_converted<293)&&(temperature_converted>=283) )
		qualifier="mild";
	else if ((temperature_converted<304)&&(temperature_converted>=293) )
		qualifier="warm";
	else
		qualifier="hot";
	}
		
question_type[qnum]="Temperature Conversions:  ";
question_type_write[qnum]="<strong>Temperature Conversions:  </strong>";
temperature=roundit(temperature,3);

statement[qnum]="The temperature outside is a "+qualifier+" "+temperature+
	" "+scale[index1]+".  What is this temperature on the "+
	scale[index2]+" scale? Answer example is 48.7 or -23.9 ";
statement_write[qnum]="The temperature outside is a "+qualifier+" <font color='#0000FF'>"+temperature+
	" "+scale[index1]+"</font>.  What is this temperature on the <font color='#0000FF'>"+
	scale[index2]+"</font> scale? <i>Answer example is 48.7 or -23.9 </i>";

//document.write(question_type[qnum]+"<p></p>"+statement[qnum]);

answer=roundit(temperature_converted,3);
return answer;

}


function ch1p6(h)
{

var qnum=6;

var answer;
var errorpcnt=0.02; // this is the allowable percentage error
range[h]=errorpcnt;

var index1;
var index2;
var index3;

index3=Math.floor(3.99*Math.random() );
index4=Math.floor(1.99*Math.random());
index1=(2*index3)+index4;
index2=Math.floor(3.99*Math.random() );

element=new Array(4);
radius=new Array(8);
scale=new Array(8);
distance_unit=new Array(4);
conversion_distance=new Array(4);

element[0]="bromine";radius[0]=1.15;scale[0]="angstroms";radius[1]=115;scale[1]="pm";
element[1]="silver";radius[2]=1.44;scale[2]="angstroms";radius[3]=144;scale[3]="pm";
element[2]="scandium";radius[4]=1.61;scale[4]="angstroms";radius[5]=161;scale[5]="pm";
element[3]="iron";radius[6]=1.24;scale[6]="angstroms";radius[7]=124;scale[7]="pm";

distance_unit[0]="cm";distance_unit[1]="in.";distance_unit[2]="m.";distance_unit[3]="ft.";
conversion_distance[0]=0.01;
conversion_distance[1]=0.0254;
conversion_distance[2]=1;
conversion_distance[3]=0.3048;

distance=80*Math.random();
distance=roundit(distance,3);

question_type[qnum]="Dimensional Analysis:  ";
question_type_write[qnum]="<strong>Dimensional Analysis:  </strong>";

statement[qnum]="The radius of the "+element[index3]+
	" atom is "+
	" "+ radius[index1]+" " +unit[index1]+". "+
	"How many of these will span a distance of "+
	distance+" "+distance_unit[index2]+"? "+
	"Answer example is 48.7 or -23.9 ";
statement_write[qnum]="The radius of the <font color='#0000FF'>"+element[index3]+
	" </font>atom is "+
	"<font color='#0000FF'>"+ radius[index1]+" " +unit[index1]+"</font>. "+
	"How many of these will span a distance of <font color='#0000FF'>"+
	distance+" "+distance_unit[index2]+"</font>? "+
	"<i>Answer example is 48.7 or -23.9 </i>";


//document.write(question_type[qnum]+"<p></p>"+statement[qnum]);

if (index4==0) answer=1.0e8;
else answer=1.0e12;
answer=answer/(2.0*radius[index1]);
answer=answer*distance*conversion_distance[index2];
answer=roundit(answer,3);

return answer;

}


function ch1p7(h)
{

var qnum=7;

var answer;
var errorpcnt=0.02; // this is the allowable percentage error
range[h]=errorpcnt;

var amount1,amount2;
var amount2str;
var index1=Math.floor(3.99*Math.random());
var index2=Math.floor(3.99*Math.random());

volume=new Array(4);
newvolume=new Array(4);
unit=new Array(4);


amount1=1.35e9*(0.25+0.75*Math.random() );

volume[0]=amount1;				unit[0]=" km";
volume[1]=amount1*1e9 ;			unit[1]=" m";
volume[2]=amount1*35.314e9 ;	unit[2]=" ft";
volume[3]=amount1*61023.0e9 ;	unit[3]=" in";

newvolume[0]="liters";
newvolume[1]="mL";
newvolume[2]="quarts";
newvolume[3]="gallons";

amount2=volume[index1];
amount2=roundit(amount2,3);

question_type[qnum]="Dimensional Analysis: Volume ";
question_type_write[qnum]="<strong>Dimensional Analysis: Volume </strong>";

statement[qnum]="One of the oceans covering the surface of the earth is found to contain"+
	" approximately "+
	amount2+unit[index1]+"3 of water.  "+
	"What is this volume in "+newvolume[index2]+
	"?Answer example is 2.36e10 ";
statement_write[qnum]="One of the oceans covering the surface of the earth is found to contain"+
	" approximately <font color='#0000FF'>"+
	amount2+unit[index1]+"<sup>3</sup></font> of water.  "+
	"What is this volume in <font color='#0000FF'>"+newvolume[index2]+
	"</font>?<i>Answer example is 2.36e10 </i>";



// document.write(question_type[qnum]+"<p></p>"+statement[qnum]);

answer=amount1*1e12;
if (index2==1) answer=answer*1e3;
if (index2==2) answer=answer*1.057;
if (index2==3) answer=answer*0.2642;
answer=roundit(answer, 3);

return answer;

}


function ch1p8(h)
{

var qnum=8;

var qnum=8;
var answer;
var errorpcnt=0.02; // this is the allowable percentage error
range[h]=errorpcnt;

var index1=Math.floor(3.99*Math.random());

amount1=175+index1*Math.floor(25*Math.random());
amount1=roundit(amount1,3);

element=new Array(4);
whoitis=new Array(4);

whoitis[0]=" healthy";
whoitis[1]="n average";
whoitis[2]="n unhealthy";
whoitis[3]=" very unhealthy";

volume1=4.5+0.75*index1*Math.random();
volume1=roundit(volume1,3);

question_type[qnum]="Dimensional Analysis:  ";
question_type_write[qnum]="<strong>Dimensional Analysis:  </strong>";



statement[qnum]="A"+whoitis[index1]+" person has about "+
	amount1+" mg of cholesterol per 100 mL of blood."+
	" If the total blood volume of that individual is "+
	volume1+" L, how many grams of total"+
	" blood cholesterol does the individual contain?Answer example is 48.7 ";

statement_write[qnum]="A"+whoitis[index1]+" person has about <font color='#0000FF'>"+
	amount1+" mg</font> of cholesterol per 100 mL of blood."+
	" If the total blood volume of that individual is <font color='#0000FF'>"+
	volume1+" L</font>, how many grams of total"+
	" blood cholesterol does the individual contain?<i>Answer example is 48.7 </i>";

// document.write(question_type[qnum]+"<p></p>"+statement[qnum]);

answer=amount1*0.001*10.0*volume1;
answer=(Math.round(answer*1000.0))/1000;
answer = roundit(answer,3);
return answer;
}


function ch1p9(h)
{

var qnum=9;

var qnum=9;
var answer;
var errorpcnt=0.02; // this is the allowable percentage error
range[h]=errorpcnt;

var radius, amount1, diameter1;
var index1=Math.floor(3.99*Math.random());
unit=new Array(4);
mass=new Array(2);
var index2=Math.floor(1.99*Math.random());

unit[0]="mm";
unit[1]="ft.";
unit[2]="in.";
unit[3]="m";

mass[0]="lb";
mass[1]="kg";

amount1=1.5+3.0*Math.random();
amount1=roundit(amount1,3);
diameter1=0.5+10.0*Math.random();
diameter1=roundit(diameter1,3);

question_type[qnum]="Dimensional Analysis: Volumetric Solids  ";
question_type_write[qnum]="<strong>Dimensional Analysis: Volumetric Solids  </strong>";

statement[qnum]="A copper refiner produces a copper ingot having a mass of "+
		amount1+ " "+mass[index2]+"  If the copper is drawn into wire whose diameter is "+
	 	diameter1+	" mm, how many "+
	 	unit[index1]+" of copper wire can be obtained from the ingot?  The density"+
		" of copper is 8.94 g/cm3.  Answer example is 48.7 or 2.32e4 ";
statement_write[qnum]="A copper refiner produces a copper ingot having a mass of <font color='#0000FF'>"+
		amount1+ " "+mass[index2]+"</font>  If the copper is drawn into wire whose diameter is <font color='#0000FF'>"+
	 	diameter1+	" mm</font>, how many <font color='#0000FF'>"+
	 	unit[index1]+"</font> of copper wire can be obtained from the ingot?  The density"+
		" of copper is 8.94 g/cm<sup>3</sup>. <i>Answer example is 48.7 or 2.32e4 </i>";
	
//document.write(question_type[qnum]+"<p></p>"+statement[qnum]);

radius=diameter1/2.0;
answer=amount1*453.7/8.94;
answer=answer/(3.14159*0.01*radius*radius);
answer=answer/100.0;
if (index1==0) answer=answer*1000.0;
if (index1==1) answer=answer/0.3048;
if (index1==2) answer=answer*39.37;

if (index2==1) answer=answer*2.205
answer=roundit(answer,3);

return answer;
}


function ch1p10(h)
{  

var qnum=10;

var qnum=10;
var answer;
var errorpcnt=0.02; // this is the allowable percentage error
range[h]=errorpcnt;

var index1=Math.floor(2.99*Math.random());

unit=new Array(3);

unit[0]="mm";
unit[1]="cm";
unit[2]="in.";

length1=10.0+10.0*Math.random();
length1=roundit(length1,3);
mass1=5.0+20.0*Math.random();
mass1=roundit(mass1,3);

question_type[qnum]="Density, Unit Conversions and Geometric Solids:  ";
question_type_write[qnum]="<strong>Density, Unit Conversions and Geometric Solids:  </strong>";

statement[qnum]="A cylindrical glass tube "+
	length1+" cm in length is filled with"+
	" ethanol.  The mass of ethanol needed to fill the tube is found to be"+
	" "+
	mass1+" g.  Calculate the inner diameter of the tube in "+
	unit[index1]+" The density of ethanol is 0.789 g/mL. Answer example is 0.0205 or 1.46e-5 ";
	
statement_write[qnum]="A cylindrical glass tube <font color='#0000FF'>"+
	length1+" cm </font>in length is filled with"+
	" ethanol.  The mass of ethanol needed to fill the tube is found to be"+
	" <font color='#0000FF'>"+
	mass1+" g.  </font>Calculate the inner diameter of the tube in <font color='#0000FF'>"+
	unit[index1]+"</font>. The density of ethanol is 0.789 g/mL. <i>Answer example is 0.0205 or 1.46e-5 </i>";
	
//document.write(question_type[qnum]+"<p></p>"+statement[qnum]);

answer=mass1/0.789;
answer=answer/(3.14159*length1);
answer=2.0*Math.sqrt(answer);

if (index1==0) answer=answer*10;
if (index1==2) answer=answer/2.54;
answer=roundit(answer,3);
return answer;
}


function ch1p11(h)
{

var qnum=11;

var qnum=11;
var answer;
var errorpcnt=0.02; // this is the allowable percentage error
range[h]=errorpcnt;

rxn=new Array(5);

question_type[qnum]="Density from mass and volume:";
question_type_write[qnum]="<strong>Density from mass and volume:</strong>";

side=1.0+0.25*Math.floor(47*Math.random());
side=roundit(side,4);
density=3+10*Math.random();
density=roundit(density,4);
mass=density*side*side*side;
mass=roundit(mass,4);
answer=density;
statement[qnum]="A cube of elemental metal "+side+" cm on a side has a mass of "+mass+
	" g.  What is its density in g/cm3?"+
	"Answer example: 2.863 (leave no spaces)";
	
statement_write[qnum]="A cube of elemental metal <font color='#0000FF'>"+side+" cm</font> on a side has a mass of <font color='#0000FF'>"+mass+
	" g</font>.  What is its density in <font color='#0000FF'>g/cm<sup>3</sup></font>?"+
	"<br><i>Answer example: 2.863 (leave no spaces)</i>";

return answer;
}


function ch1p12(h)
{

var qnum=12;


var answer;
var errorpcnt=0.02; // this is the allowable percentage error
range[h]=errorpcnt;

question_type[qnum]="Density and volume of a geometric solid:";
question_type_write[qnum]="<strong>Density and volume of a geometric solid:</strong>";

density=2.5+10*Math.random();
density=roundit(density,3);
leng=16+20*Math.random();
leng=roundit(leng,4);
radius=10+8*Math.random();
radius=roundit(radius,4);
diameter=2.0*radius;
mass=3.14159*radius*radius*leng*density/1000.0;
mass=roundit(mass,3);
answer=roundit(diameter,3);

statement[qnum]="A cylindrical rod formed from an elemental metal is "+leng+" cm in length"+
	" and has a mass of "+mass+" kg.  The density of the element is "+density+
	" g/cm3.  What is the diameter of the cylinder in cm.?"+
	"Answer example: 3.45e3 (leave no spaces)";
	
statement_write[qnum]="A cylindrical rod formed from an elemental metal is <font color='#0000FF'>"+leng+" cm </font>in length"+
	" and has a mass of <font color='#0000FF'>"+mass+" kg</font>.  The density of the element is <font color='#0000FF'>"+density+
	" g/cm<sup>3</sup></font>.  What is the diameter of the cylinder in <font color='#0000FF'>cm.</font>?"+
	"<br><i>Answer example: 3.45e3 (leave no spaces)</i>";

return answer;
}


function ch1p13(h)
{

var qnum=13;

var qnum=13;
var answer;
var errorpcnt=0.02; // this is the allowable percentage error
range[h]=errorpcnt;

rxn=new Array(5);

question_type[qnum]="Dimensional analysis and volume:";
question_type_write[qnum]="<strong>Dimensional analysis and volume:</strong>";

leng=10+0.25*Math.floor(9*Math.random());
width=15+0.25*Math.floor(9*Math.random());
height=8+0.25*Math.floor(4*Math.random());
leng=roundit(leng,3);
width=roundit(width,3);
height=roundit(height,3);
density=0.9+0.2*Math.random();
density=roundit(density,3);
mass=0.001*density*leng*width*height*30.48*30.48*30.48/1000.0;
answer=roundit(mass,3);   

statement[qnum]="The density of air in a mountain resort cabin at 298 K is "+
	"found to be "+density+" g/L.  What is the mass, in kilograms, of the air"+
	" in a room that measures "+ leng +" x "+ width +" x "+height+" ft.?"+
	"Answer example: 3.45e3 (leave no spaces)";
	
statement_write[qnum]="The density of air in a mountain resort cabin at 298 K is "+
	"found to be <font color='#0000FF'>"+density+" g/L.</font>  What is the <font color='#0000FF'>mass, in kilograms,</font> of the air"+
	" in a room that measures <font color='#0000FF'>"+ leng +" x "+ width +" x "+height+" ft.</font>?"+
	"<br><i>Answer example: 3.45e3 (leave no spaces)</i>";

return answer;
}


function ch1p14(h)
{

var qnum=14;

var qnum=14;
var answer;
var errorpcnt=0.02; // this is the allowable percentage error
range[h]=errorpcnt;

rxn=new Array(5);

question_type[qnum]="Concentration of gases and dimensional analysis:";
question_type_write[qnum]="<strong>Concentration of gases and dimensional analysis:</strong>";

leng=10+0.25*Math.floor(9*Math.random());
width=15+0.25*Math.floor(9*Math.random());
height=8+0.25*Math.floor(4*Math.random());
leng=roundit(leng,3);
width=roundit(width,3);
height=roundit(height,3);
conc=30+40*Math.random();
conc=roundit(conc,3);

mass=conc*1e-6*0.001*leng*width*height*30.48*30.48*30.48/1000.0;
answer=roundit(mass,3);  

statement[qnum]="The concentration of carbon monoxide in a dormitory room is "+
	conc+" ug/m3.  What is the mass in grams of carbon monoxide present in a room measuring "+
	leng +" x "+ width +" x "+height+" ft.?"+
	"Answer example: 3.45e-4 (leave no spaces)";
	
statement_write[qnum]="The concentration of carbon monoxide in a dormitory room is <font color='#0000FF'>"+
	conc+" <font face='Symbol'>m</font>g/m<sup>3</sup>.</font>  What is the mass in grams of carbon monoxide present in a room measuring <font color='#0000FF'>"+
	leng +" x "+ width +" x "+height+" ft.</font>?"+
	"<br><i>Answer example: 3.45e-4 (leave no spaces)</i>";

return answer;
}


function ch1p15(h)
{

var qnum=15;

var qnum=15;
var answer;
var errorpcnt=0.02; // this is the allowable percentage error
range[h]=errorpcnt;

rxn=new Array(5);

question_type[qnum]="Density and additive volumes:";
question_type_write[qnum]="<strong>Density and additive volumes:</strong>";

mass1=24+15*Math.random();
mass1=roundit(mass1,4);
densitys=0.9+2*Math.random();
densitys=roundit(densitys,4);
answer=densitys;
density=0.8+0.2*Math.random();
density=roundit(density,4);
volumes=mass1/densitys;
volumes=roundit(volumes,4);
masstoluene=40+25*Math.random();
masstoluene=roundit(masstoluene,4);
volumetoluene=masstoluene/density;
volume=1.0*volumes+1.0*volumetoluene;
mass2=1.0*masstoluene+1.0*mass1;
volume=roundit(volume,4);
mass2=roundit(mass2,4);

statement[qnum]="A "+mass1+" g sample of a solid is placed in a flask. Toluene "+
	"in which the solid is insoluble, is added to the flask so that the total "+
	"volume of completely submerged solid and liquid together is "+volume+
	" mL.  The solid and toluene together have a mass of "+mass2 +" g."+
	" The density of toluene at the temperature of the experiment is "+density+
	" g/mL.  What is the density of the solid in g/cm3?"+
	"Answer example: 3.451 ";
	
statement_write[qnum]="A <font color='#0000FF'>"+mass1+" g</font> sample of a solid is placed in a flask. Toluene, "+
	"in which the solid is insoluble, is added to the flask so that the total "+
	"volume of completely submerged solid and liquid together is <font color='#0000FF'>"+volume+
	" mL.</font>  The solid and toluene together have a mass of <font color='#0000FF'>"+mass2 +" g.</font>"+
	" The density of toluene at the temperature of the experiment is <font color='#0000FF'>"+density+
	" g/mL.</font>  What is the density of the solid in <font color='#0000FF'>g/cm<sup>3</sup></font>?"+
	"<br><i>Answer example: 3.451 </i>";

return roundit(answer,4);
}

function ch1p16(h)
{

var qnum=16;

var answer;
var errorpcnt=0.02; // this is the allowable percentage error
range[h]=errorpcnt;

rxn=new Array(5);

volume=50+50*Math.random();
volume=roundit(volume,3);
density=3+6*Math.random();
density=roundit(density,3);

answer=1.0*density*volume;

question_type[qnum]="Density and displacement:";
question_type_write[qnum]="<strong>Density and displacement:</strong>";

answer=roundit(answer,3);

statement[qnum]="The density of a metal alloy is "+density+"g/cm3 at 25 oC.  What mass in g. of this alloy"+
	" displaces "+volume+" mL of water at 25 oC?"+
	"Answer example: 3.451 ";
	
statement_write[qnum]="The density of a metal alloy is <font color='#0000FF'>"+density+"g/cm<sup>3</sup></font> at 25 <sup>o</sup>C.  What mass in g. of this alloy"+
	" displaces <font color='#0000FF'>"+volume+" mL</font> of water at 25 <sup>o</sup>C?"+
	"<br><i>Answer example: 3.451 </i>";

return answer;
}

function ch1p17(h)
{

var qnum=17;

var answer;
var errorpcnt=0.02; // this is the allowable percentage error
range[h]=errorpcnt;

datum=new Array(35);
sig=new Array(35);

datum[0]=5280;sig[0]=3;
datum[1]=0.05142;sig[1]=4;
datum[2]=51200;sig[2]=3;
datum[3]=430.76;sig[3]=5;
datum[4]=8.030;sig[4]=4;
datum[5]=0.011;sig[5]=2;
datum[6]=0.000476;sig[6]=3;
datum[7]=3.8909e2;sig[7]=5;
datum[8]=20;sig[8]=1;
datum[9]=30.0;sig[9]=3;
datum[10]=300.00;sig[10]=5;
datum[11]=0.00041;sig[11]=2;
datum[12]=5.800;sig[12]=4;
datum[13]=0.0;sig[13]=2;
datum[14]=1400;sig[14]=2;
datum[15]=0.05e4;sig[15]=1;
datum[16]=217;sig[16]=3;
datum[17]=204.080;sig[17]=6;
datum[18]=0.0246;sig[18]=3;
datum[19]=2;sig[19]=1;

question_type[qnum]="Significant figures:";
question_type_write[qnum]="<strong>Significant figures:</strong>";
index1=Math.floor(19.99*Math.random());
answer=sig[index1];
if (index1==4) datum[index1]=roundit(datum[index1],sig[index1]);
if (index1==9) datum[index1]=roundit(datum[index1],sig[index1]);
if (index1==10) datum[index1]=roundit(datum[index1],sig[index1]);
if (index1==12) datum[index1]=roundit(datum[index1],sig[index1]);
if (index1==17) datum[index1]=roundit(datum[index1],sig[index1]);

statement[qnum]="How many significant figures are in a datum that is reported as "+datum[index1]+" ?"+
	"Answer example: 3 ";
	
statement_write[qnum]="How many significant figures are in a datum that is reported as <font color='#0000FF'>"+
	datum[index1]+" </font>?"+
	"<br><i>Answer example: 3 </i>";

return answer;
}


function ch1p18(h)
{

var qnum=18;

var answer;
var errorpcnt=0.02; // this is the allowable percentage error
range[h]=errorpcnt;

rxn=new Array(5);

question_type[qnum]="Dimensional analysis:";
question_type_write[qnum]="<strong>Dimensional analysis:</strong>";

pct=60+35*Math.random();
pct=roundit(pct,3);
mass=20+10*Math.random();
mass=roundit(mass,3);
price=5+2*Math.random();
price=roundit(price,3);
answer=0.01*pct*mass*price/31.1;
answer=roundit(answer,3);

statement[qnum]="A silver coin of mass "+mass+ " g. is found to contain "+pct+
	" % by mass silver.  If silver is valued at "+price+" $/troy ounce, and 1 troy ounce weighs "+
	"31.1 g., what is the value of the coin in dollars?"+
	"Answer example: 34.51 ";
	
statement_write[qnum]="A silver coin of mass <font color='#0000FF'>"+mass+ " g.</font> is found to contain <font color='#0000FF'>"+pct+
	" % </font>by mass silver.  If silver is valued at <font color='#0000FF'>"+price+" $/troy ounce</font>, and 1 troy ounce weighs "+
	"31.1 g., what is the value of the coin in dollars?"+
	"<br><i>Answer example: 34.51 </i>";

return answer;
}
