% The following procedure contains all the information for the fifth page
% of the 'Dalton's Model' option.
procedure dalt_page_5
    openpage
    color (2)
    locate (9, 38)
    put " Dalton's Theory Predicts the"
    locate (10, 37)
    put "Law of Multiple Proportions con't"
    color (3)
    locate (12, 27)
    put "Since there are proportionally half as many oxygen"
    locate (13, 27)
    put "atoms in one  compound as in  the other, and since"
    locate (14, 27)
    put "each  oxygen atom has  the same mass  according to"
    locate (15, 27)
    put "Dalton's theory, the  proportions of  mass in each"
    locate (16, 27)
    put "compound that are due  to oxygen are also in a 1:2"
    locate (17, 27)
    put "ratio."
    locate (23, 51)
    color (2)
    put "-5-"
end dalt_page_5

% The following procedure contains all the information for the fourth page
% of the 'Dalton's Model' option.
procedure dalt_page_4
    openpage
    color (2)
    locate (9, 38)
    put "Dalton's Theory  Predicts the"
    locate (10, 39)
    put "Law of Multiple Proportions"
    color (12)
    locate (12, 27)
    put "   Law of Multiple Proportions"
    color (3)
    locate (12, 58)
    put " states  that  when"
    locate (13, 27)
    put "the proportions by mass in which two elements com-"
    locate (14, 27)
    put "bine to form  two different  compounds are divided"
    locate (15, 27)
    put "by each other,  the result is  a fraction of small"
    locate (16, 27)
    put "whole  numbers.  For example, carbon  monoxide has"
    locate (17, 27)
    put "one oxygen atom and  carbon dioxide has two oxygen"
    locate (18, 27)
    put "atoms.  The ratio of oxygen  atoms to carbon atoms"
    locate (19, 27)
    put "in the two compounds is 1:2.                      "
    locate (21, 27)
    put "    O atoms per C atom in carbon monoxide    1    "
    locate (22, 27)
    put "    O atoms per C atom in carbon dioxide     2    "
    drawline (235, 56, 538, 56, 2)
    drawline (566, 56, 577, 56, 2)
    drawline (550, 58, 555, 58, 15)
    drawline (550, 54, 555, 54, 15)
    locate (23, 51)
    color (2)
    put "-4-"
end dalt_page_4

% The following procedure contains all the information for the third page
% of the 'Dalton's Model' option.
procedure dalt_page_3
    openpage
    color (2)
    locate (9, 38)
    put "Dalton's Theory  Explains the"
    locate (10, 39)
    put "Law of Constant Composition"
    color (3)
    locate (12, 27)
    put "   The                             states that the"
    color (12)
    locate (12, 34)
    put "Law of Constant Composition"
    color (3)
    locate (13, 27)
    put "percentage  composition  by mass  of a  particular"
    locate (14, 27)
    put "compound never varies.  For example, 1 carbon atom"
    locate (15, 27)
    put "will  always react  with one  oxygen atom  to form"
    locate (16, 27)
    put "carbon monoxide.  Hence, fifteen carbon atoms will"
    locate (17, 27)
    put "always  react with  fifteen  oxygen atoms  to form"
    locate (18, 27)
    put "fifteen carbon monoxide molecules. Dalton's theory"
    locate (19, 27)
    put "states that  all carbon  atoms have  the same mass"
    locate (20, 27)
    put "and all oxygen atoms have the same mass. Therefore"
    locate (21, 27)
    put "the mass of carbon monoxide is the sum of the mass"
    locate (22, 27)
    put "of the carbon atom and the oxygen atom."
    locate (23, 51)
    color (2)
    put "-3-"
end dalt_page_3

% The following procedure contains all the information for the second page
% of the 'Dalton's Model' option.
procedure dalt_page_2
    openpage
    color (2)
    locate (9, 38)
    put "Dalton's Theory  Explains the"
    locate (10, 39)
    put "Law of Conservation of Mass"
    color (3)
    locate (12, 27)
    put "The                     of Mass states that during"
    locate (12, 31)
    color (12)
    put "Law of Conservation of Mass"
    color (3)
    locate (13, 27)
    put "a chemical  reaction,  matter  is neither  created"
    locate (14, 27)
    put "nor destroyed. Hence,  if Dalton's  theory  states"
    locate (15, 27)
    put "that  chemical   reactions are  the separation  or"
    locate (16, 27)
    put "union  of atoms,  and  atoms  are  indestructible,"
    locate (17, 27)
    put "then a  chemical  reaction would  not involve  the"
    locate (18, 27)
    put "creation or  destruction of atoms.  Thus,  mass is"
    locate (19, 27)
    put "neither created nor destroyed."
    locate (23, 51)
    color (2)
    put "-2-"
end dalt_page_2

% The following procedure contains all the information for the first page
% of the 'Dalton's Model' option.
procedure dalt_page_1
    if flag not= 0 then
	openpage
    end if
    color (2)
    locate (9, 27)
    put "POSTULATES OF DALTON'S THEORY:"
    color (3)
    locate (11, 27)
    put "1. All matter is composed of extremely small"
    locate (12, 27)
    put "   particles called atoms."
    locate (13, 27)
    put "2. Atoms can be neither subdivided nor changed"
    locate (14, 27)
    put "   into one another."
    locate (15, 27)
    put "3. Atoms cannot be created nor destroyed."
    locate (16, 27)
    put "4. All atoms of one element are the same in"
    locate (17, 27)
    put "   shape, size, mass, and all other properties."
    locate (18, 27)
    put "5. All atoms of one element differ in these"
    locate (19, 27)
    put "   properties from atoms of all other elements."
    locate (20, 27)
    put "6. Chemical change is the union or separation "
    locate (21, 27)
    put "   of atoms."
    locate (22, 27)
    put "7. Atoms combine in small whole-number ratios such"
    locate (23, 27)
    put "   as 1:1, 1:2, 2:3, etc."
end dalt_page_1

% This procedure is the main call up procedure of the 'Dalton's Model'
% option.  It draws the spinning atom at the top of the screen and calls
% up all other procedures needed to perform this option.
procedure dalt_main
    flag := 0
    pagenum := 1
    drawbox (0, 0, maxx, maxy, 2)
    color (14)
    locate (2, 15)
    put "D A L T O N ' S   M O D E L   O F   T H E   A T O M"

    % draw the atom
    drawoval (100, 230, 55, 42, 4)
    drawfill (100, 230, 4, 4)
    % draw pointer line
    drawline (120, 240, 180, 280, 15)
    drawline (180, 280, 250, 280, 15)

    % write description of model
    color (12)
    locatexy (260, 280)
    put "Similar to the Greek model:"
    locatexy (260, 270)
    put "known as the `billiard ball' model."

    draw_keys
    drawpage
    dalt_page_1

    x := 55
    % check variable used to check where arc was last drawn
    check := 0
    loop
	x1 := 200
	x2 := 620
	y := 20
	y2 := 243
	% atom having the illusion of revolving
	loop
	    if check = 1 then
		loop
		    drawarc (100, 230, x, 42, 270, 90, 12)
		    drawarc (100, 230, x, 42, 270, 90, 4)
		    x := x + 6
		    % draw pointer line
		    drawline (120, 240, 180, 280, 15)
		    if x = 55 then
			check := 0
			drawoval (100, 230, 55, 42, 12)
			drawoval (100, 230, 55, 42, 12)
			drawoval (100, 230, 55, 42, 12)
			drawoval (100, 230, 55, 42, 12)
			drawoval (100, 230, 55, 42, 4)
		    end if
		    exit when x = 55 or hasch
		end loop
	    else
		loop
		    check := 0
		    % draw pointer line
		    drawline (120, 240, 180, 280, 15)
		    drawarc (100, 230, x, 42, 90, 270, 12)
		    drawarc (100, 230, x, 42, 90, 270, 4)
		    x := x - 6
		    if x = 1 then
			check := 1
		    end if
		    exit when x = 1 or hasch
		end loop
	    end if
	    exit when hasch
	end loop

	pgup_pgdn  % calls up procedure to check what key has been inputted
		   % by the user.

	if flag = 1 then   % checks to see if user inputted key stating that
	    close_page     % he\she wants to go to next page of option.
	end if
	exit when flag = 2 % exits when user has chosen 'm' key.

	if flag = 1 then    %  checks to see which page user is on and calls
		  %  up the procedure that contains that page's information.
	    if pagenum = 1 then
		dalt_page_1
	    elsif pagenum = 2 then
		dalt_page_2
	    elsif pagenum = 3 then
		dalt_page_3
	    elsif pagenum = 4 then
		dalt_page_4
	    elsif pagenum = 5 then
		dalt_page_5
	    end if
	end if
    end loop
end dalt_main
