#!/usr/bin/perl -w #ported from cgi-lib.pl to cgi.pm feb. 2002 jb use CGI qw(:cgi-lib); &ReadParse; #******************************VARIABLES******************** $answer1 = $in{'rdQ2'}; #User's answer $answertype = $in{'checkifcorrect'}; #Variable stores hidden input checks if answer right $user_tries = 0; #Variable used to store count of attempts at answering questions $user_finalscore = 0;#Variable used to store the final score of the user #**********************ANALYZE USER INPUT*************** #Check player's answer to question 1 if(($answer1 ne "") && ($answer1 ne undef) && ($answer1 eq "Lamar") || ($answer1 eq "Pope") || ($answer1 eq "Delaware") || ($answer1 eq "Hoover")) { &firstsetofresponses(); #Call subroutine that generates responses } #Check player's answer to question 2 elsif(($answer1 ne "") && ($answer1 ne undef) && ($answer1 eq "JA") || ($answer1 eq "FH") || ($answer1 eq "R") || ($answer1 eq "JM")) { &secondsetofresponses(); #Call subroutine that generates responses } #Check player's answer to question 3 elsif(($answer1 ne "") && ($answer1 ne undef) && ($answer1 eq "or") || ($answer1 eq "farm") || ($answer1 eq "gv") || ($answer1 eq "br")) { &thirdsetofresponses(); #Call subroutine that generates responses } #Check player's answer to question 4 elsif(($answer1 ne "") && ($answer1 ne undef) && ($answer1 eq "healthprob") || ($answer1 eq "andrewja") || ($answer1 eq "andrewjo") || ($answer1 eq "grovc")) { &fourthsetofresponses(); #Call subroutine that generates responses } #Check player's answer to question 5 elsif(($answer1 ne "") && ($answer1 ne undef) && ($answer1 eq "tedr") || ($answer1 eq "rreag") || ($answer1 eq "usg") || ($answer1 eq "grndfrm")) { &fifthsetofresponses(); #Call subroutine that generates responses } #Check player's answer to question 6 elsif(($answer1 ne "") && ($answer1 ne undef) && ($answer1 eq "ghs") || ($answer1 eq "gf") || ($answer1 eq "gb") || ($answer1 eq "zit")) { &sixthsetofresponses(); #Call subroutine that generates responses } #Check player's answer to question 7 elsif(($answer1 ne "") && ($answer1 ne undef) && ($answer1 eq "de") || ($answer1 eq "ug") || ($answer1 eq "capharry") || ($answer1 eq "zt")) { &seventhsetofresponses(); #Call subroutine that generates responses } #Check player's answer to question 8 elsif(($answer1 ne "") && ($answer1 ne undef) && ($answer1 eq "manyjobs") || ($answer1 eq "ww") || ($answer1 eq "howie") || ($answer1 eq "jc")) { &eighthsetofresponses(); #Call subroutine that generates responses } #Check player's answer to question 9 elsif(($answer1 ne "") && ($answer1 ne undef) && ($answer1 eq "rn") || ($answer1 eq "mb") || ($answer1 eq "grover") || ($answer1 eq "countyjudge")) { &ninthsetofresponses(); #Call subroutine that generates responses } #Check player's answer to question 10 elsif(($answer1 ne "") && ($answer1 ne undef) && ($answer1 eq "grcl") || ($answer1 eq "wilmc") || ($answer1 eq "sweet") || ($answer1 eq "frankrose")) { &tenthsetofresponses(); #Call subroutine that generates responses } #******************Control sequence of questions based on user answers***** #If the first answer is correct, output second question elsif($answertype eq "correct1") { &questionTop(); &question2(); } #If the first answer is wrong, output the first question again elsif($answertype eq "wrong1") { &questionTop(); &question1(); } #If the second answer is correct, output the third question elsif($answertype eq "correct2") { &questionTop(); &question3(); } #If the second answer is incorrect, output the second question again elsif($answertype eq "wrong2") { &questionTop(); &question2(); } #If the third answer is correct, output the fourth question elsif($answertype eq "correct3") { &questionTop(); &question4(); } #If the third answer is incorrect, output the third question again elsif($answertype eq "wrong3") { &questionTop(); &question3(); } #If the fourth answer is correct, output the fifth question elsif($answertype eq "correct4") { &questionTop(); &question5(); } #If the fourth answer is incorrect, output the fourth question again elsif($answertype eq "wrong4") { &questionTop(); &question4(); } #If the fifth answer is correct, output the sixth question elsif($answertype eq "correct5") { &questionTop(); &question6(); } #If the fifth answer is incorrect, output the fifth question again elsif($answertype eq "wrong5") { &questionTop(); &question5(); } #If the sixth answer is correct, output the seventh question elsif($answertype eq "correct6") { &questionTop(); &question7(); } #If the sixth answer is incorrect, output the sixth question again elsif($answertype eq "wrong6") { &questionTop(); &question6(); } #If the seventh answer is correct, output the seventh question elsif($answertype eq "correct7") { &questionTop(); &question8(); } #If the seventh answer is incorrect, output the seventh question again elsif($answertype eq "wrong7") { &questionTop(); &question7(); } #If the eighth answer is correct, output the ninth question elsif($answertype eq "correct8") { &questionTop(); &question9(); } #If the eighth answer is incorrect, output the eighth question again elsif($answertype eq "wrong8") { &questionTop(); &question8(); } #If the ninth answer is correct, output the tenth question elsif($answertype eq "correct9") { &questionTop(); &question10(); } #If the ninth answer is incorrect, output the ninth question again elsif($answertype eq "wrong9") { &questionTop(); &question9(); } #If the tenth answer is incorrect, output the tenth question again elsif($answertype eq "wrong10") { &questionTop(); &question10(); } #Output initial question page else{ &questionTop(); &question1(); } #******************************SUBROUTINES***************************************** #***************QUESTIONS SUBROUTINES******************** #*****SUBROUTINE THAT OUTPUTS HEADER FOR QUESTIONS******* sub questionTop { print "Content-type: text/html\n\n"; print "\n"; print "\n"; output_nav(); print "

WHERE'S HARRY?



\n"; } #****************SUBROUTINE THAT OUTPUTS FIRST QUESTION********************* sub question1 { print "
\n"; print "Where's Baby Harry?

\n"; print "\n"; print "
\n"; print "I was born in Lamar, Mo. on May 8, 1884
I was born in Pope's Creek, VA on Feb. 22, 1732
I was born in Delaware, Ohio on Oct. 4, 1882.
I was born in West Branch, Iowa on Aug. 10, 1874.

\n"; print "
\n"; print "

How to Play\n"; } #****************SUBROUTINE THAT OUTPUTS SECOND QUESTION********************* sub question2 { print "Where are Harry's Parents?

My Parents were John and Abigail. My father was also President.
My Parents were Frank and Hannah. The owned a gasoline station and country store.
My Parents were Richard and ________. My father was a minister.
My Parents were John and Martha. They were farmers.

\n"; } #****************SUBROUTINE THAT OUTPUTS THIRD QUESTION********************* sub question3 { print "Where is Harry's childhood home?

I was raised until the age of seven in a one-room cabin with a dirt floor.
I was raised on a large 600-acre farm with 13 brothers and sisters
I was born in Lamar but soon moved to Grandview to live on my grandparents' farm.
I was raised in a house that overlooked the Blue Ridge Mountains and was built by my grandfather. I remained in this home all my life.

\n"; } #**************OUTPUTS FOURTH QUESTION***************** sub question4 { print "What were Harry's Childhood Activities?

At the age of thirteen, I joined the Continental Army.
I had many health problems when I was a young boy. However, I did read all of the books in the public library by the age of 13.
I was a very large, but active boy who loved playing baseball.
When I was twelve, I was apprenticed to a tailor.

\n"; } #****************OUTPUTS FIFTH QUESTION********************** sub question5 { print "What did Harry do as a young adult?

My early years were spent as a rancher in the Dakota Territory.
My early adult years were spent as an actor and radio announcer in Hollywood.
My early adult years were spent at West Point military academy.
My early adult years were spent toiling on my grandparents' farm in the midwest.

\n"; } #**************OUTPUTS SIXTH QUESTION***************** sub question6 { print "What was Harry's educational background?

I graduated from high school in 1901 with my future wife; but family finances prevented me from attending college.
I went to the University of Michigan where I was a football star.
After serving as the youngest naval pilot during WWII, I graduated from Yale University.
I received a very basic wilderness education and did not attend college.

\n"; } #**************OUTPUTS SEVENTH QUESTION***************** sub question7 { print "What was Harry's military experience?

After graduating from West Point, I eventually became an Allied commander during WWII and led the D-Day invasion.
After graduating from West Point, I eventually became the head of the Union Army during the Civil War.
I served as a Captain with Battery D and fought in World War I.
I served forty years as an officer, including the Mexican War where I became a national hero.

\n"; } #**************OUTPUTS EIGHTH QUESTION***************** sub question8 { print "What was Harry's vocation?

I had a variety of jobs including farmer, bank clerk and owner of a men's clothing store.
I served as a college professor before entering politics.
I was the first President to serve on the Supreme Court.
I ran the family peanut business before I entered politics.

\n"; } #**************OUTPUTS NINTH QUESTION***************** sub question9 { print "What was Harry's early political life?

I made a name for myself in Congress by questioning accused spy Alger Hiss.
I was nicknamed the Little Magician because of my craftiness in Congress.
I was the reform mayor in a major city before becoming governor of my state.
I served as County Judge before being elected U.S. Senator in 1934.

\n"; } #**************OUTPUTS TENTH QUESTION***************** sub question10 { print "Who did Harry marry?

While living in the White House, I married the youngest first lady ever.
My wife was the first wife of a President to have been in a profession other than teaching. She was a bank cashier.
After returning from the war, I married my childhood sweetheart. We were both in our 30's at the time of our marriage.
I married my second cousin who also had the same last name as mine.

\n"; } #*************ANSWERS SUBROUTINES************* #*******ANSWERS/RESPONSES TO FIRST QUESTION************** sub firstsetofresponses { if($answer1 eq "Lamar"){ &clear_scores();#flushes scores file so old scores not added to new ones &store_correctattempts();#call subroutine that stores value for correct attempt &check_attempts();#call subroutine that checks number of attempts in order to compute score &clear_attempts();#clears attempts so that start fresh with next question &pgeTop(); print "
Harry Truman, 1884

\n"; print "Born on May 8, 1884, in Lamar, Missouri, Harry was the first born child of John and Martha Truman. When little Harry was born, his parents were in a bit of a tizzy. Mr. Truman' s father wanted the new baby to be named Anderson Shippe after himself, but Mrs. Truman's father wanted him to be named Solomon after himself! And to make matters worse, Martha Truman wanted her son to be named Harrison, after her brother. Well, John Truman came up with a great solution. \"Let's name him Harry S. Truman. The S can stand for both of his grandpas.\" Martha Truman agreed, \"Yes, I like that idea\!\"\n"; print "

\n"; &pgeBottom(); } elsif ($answer1 eq "Pope"){ &store_wrongattempts();#Call subroutine that stores the attempt in a file. &pgeTop(); print "
Incorrect answer, please try again. This is George Washington. To find out more about President Washington visit Grolier presidential biographies.
Please go back to the original question.

\n"; print "

\n"; print "
\n"; &pgeBottom(); } elsif ($answer1 eq "Delaware"){ &store_wrongattempts();#Call subroutine that stores the attempt in a file. &pgeTop(); print "
Incorrect answer, please try again. This is Rutherford B. Hayes. To find out more about President Hayes visit Grolier presidential biographies.
Please go back to the original question.

\n"; print "

\n"; print "
\n"; &pgeBottom(); } elsif ($answer1 eq "Hoover"){ &store_wrongattempts();#Call subroutine that stores the attempt in a file. &pgeTop(); print "
Incorrect answer, please try again. This is Herbert Hoover. To find out more about President Hoover visit the Herbert Hoover National Historic Site page.
Please go back to the original question.

\n"; print "

\n"; print "
\n"; &pgeBottom(); } } #******************QUESTION TWO RESPONSES****** sub secondsetofresponses { if($answer1 eq "JA") { &store_wrongattempts();#Call subroutine that stores the attempt in a file. &pgeTop(); print "
Incorrect answer, please try again. This is John Quincy Adams. To find out more about President Adams visit Grolier presidential biographies .
Please go back to the original question
\n"; print "
\n"; &pgeBottom(); } elsif ($answer1 eq "FH"){ &store_wrongattempts();#Call subroutine that stores the attempt in a file. &pgeTop(); print "
Incorrect answer, please try again. This is Richard Nixon. To find out more about President Nixon visit Grolier presidential biographies .
Please go back to the original question
\n"; print "
\n"; &pgeBottom(); } elsif ($answer1 eq "R"){ &store_wrongattempts();#Call subroutine that stores the attempt in a file. &pgeTop(); print "
Incorrect answer, please try again. This is Grover Cleveland. To find out more about President Cleveland visit Grolier presidential biographies.
Please go back to the original question
\n"; print "
\n"; &pgeBottom(); } elsif ($answer1 eq "JM"){ &store_correctattempts();#call subroutine that stores value for correct attempt &check_attempts();#call subroutine that checks number of attempts in order to compute score &clear_attempts();#clears attempts so that start fresh with next question &pgeTop(); print "
\n"; print "
Harry's Parents

\n"; print "

\n"; print "Harry's parents, John Anderson Truman and Martha Ellen Young Truman, were hardworking farmers. They had not been too successful when Harry was a very young boy. John Truman had not done well as a mule trader and farmer. In fact, he had moved his family three times by the time Harry was six. In 1890, the Trumans moved out of Harry's grandparents' farm home in Grandview, Missouri, and headed for Independence, Missouri. By this time Harry had a younger brother, Vivian, and a baby sister, Mary Jane.\n"; print "
\n"; print "John Truman did much better in the bigger town of Independence. He was successful in farming and real estate. John Truman was a small, tough, wiry man who once chased a lawyer out of a courthouse for calling him a liar. Harry's mother, Martha Young Truman, loved books and music and gave Harry a \"head start\" on school by teaching him to read.

\n"; print "

\n"; print "
\n"; &pgeBottom(); } } #******************QUESTION THREE RESPONSES****** sub thirdsetofresponses { if($answer1 eq "or") { &store_wrongattempts();#Call subroutine that stores the attempt in a file. &pgeTop(); print "
Incorrect answer, please try again. This is Abraham Lincoln. To find out more about President Lincoln visit The History Place Abraham Lincoln exhibit.
Please go back to the original question.
\n"; print "
\n"; &pgeBottom(); } elsif($answer1 eq "farm") { &store_wrongattempts();#Call subroutine that stores the attempt in a file. &pgeTop(); print "
Incorrect answer, please try again. This is Benjamin Harrison. To find out more about President Harrison visit Grolier presidential biographies.
Please go back to the original question.
\n"; print "
\n"; &pgeBottom(); } elsif($answer1 eq "gv") { &store_correctattempts();#call subroutine that stores value for correct attempt &check_attempts();#call subroutine that checks number of attempts in order to compute score &clear_attempts();#clears attempts so that start fresh with next question &pgeTop(); print "
Truman Farm in Grandview

\n"; print "Harry Truman's birthplace was a six room, white frame house in Lamar, Missouri. His parents, John and Martha Young Truman, purchased the home in 1882 for \$685. Harry was born there on May 8, 1884. His father planted a pine tree in the yard and it is still standing. His family moved to his grandparents' farm in Grandview, Missouri, about a year later.\n"; print "

\n"; print "

\n"; &pgeBottom(); } elsif($answer1 eq "br") { &store_wrongattempts();#Call subroutine that stores the attempt in a file. &pgeTop(); print "
Incorrect answer, please try again. This is James Madison. To find out more about President Madison visit Grolier presidential biographies.
Please go back to the original question.
\n"; print "
\n"; &pgeBottom(); } } #*******************QUESTION FOUR RESPONSES******** sub fourthsetofresponses { if($answer1 eq "healthprob"){ &store_correctattempts();#call subroutine that stores value for correct &check_attempts();#call subroutine that checks number of attempts in order &clear_attempts();#clears attempts so that start fresh with next question &pgeTop(); print "
\n"; print "
Harry, age 13

\n"; print "Although Harry's mother taught him to read from the Bible at age 5, he had trouble seeing and reading other print and objects. When young Harry couldn't see the brilliance of the 4th of July fireworks, his mother made the 15 mile journey by horse and wagon to Kansas City to see the doctor. Harry was diagnosed with myopia, an eye disorder and was required to wear very thick glasses. The glasses were so expensive and fragile Harry was ordered to avoid rough activities. Still he managed to play and make friends. Truman seemed to have more than his share of boyhood illnesses and accidents. None of these affected his future as profoundly as his poor eyesight.\n"; print "

\n"; &pgeBottom(); } elsif($answer1 eq "andrewja"){ &store_wrongattempts();#Call subroutine to store tries &pgeTop(); print "
Incorrect answer, please try again. This is Andrew Jackson. To find out more about President Jackson visit the White House web site.
Please go back to the original question.
\n"; print "
\n"; &pgeBottom(); } elsif($answer1 eq "andrewjo") { &store_wrongattempts();#Call subroutine to store tries &pgeTop(); print "
Incorrect answer, please try again. This is Andrew Johnson. To find out more about President Johnson visit the White House web site.
Please go back to the original question.
\n"; print "
\n"; &pgeBottom(); } elsif($answer1 eq "grovc") { &store_wrongattempts();#Call subroutine to store tries &pgeTop(); print "
Incorrect answer, please try again. This is Grover Cleveland. To find out more about President Cleveland visit the Grolier's presidential biographies.
Please go back to the original question.
\n"; print "
\n"; &pgeBottom(); } } #********************QUESTION FIVE RESPONSES***** sub fifthsetofresponses { if($answer1 eq "grndfrm"){ &store_correctattempts();#call subroutine that stores value for correct &check_attempts();#call subroutine that checks number of attempts in order &clear_attempts();#clears attempts so that start fresh with next question &pgeTop(); print "
\n"; print "
Harry Truman riding a cultivator on his Grandview farm.

\n"; print "Harry's dream had always been to attend West Point. He studied and worked long hours to prepare. But to his disappointment, he was rejected because of his poor eyesight. Little did he know that years later he would be welcomed into that same army as a commanding officer during World War I.

At the age of 22 he returned to the farm in Grandview, Mo. Here according to his mother, Martha, he learned 'common sense'. The work was hard but Harry took great pride in his efforts. After his father's death in 1914, Truman was sole decision maker for the farm until in 1917 he left for war.\n"; print "

\n"; &pgeBottom(); } elsif($answer1 eq "tedr") { &store_wrongattempts();#Call subroutine to store tries &pgeTop(); print "
Incorrect answer, please try again. This is Theodore Roosevelt. To find out more about President Roosevelt visit the White House web site.
Please go back to the original question.
\n"; print "
\n"; &pgeBottom(); } elsif($answer1 eq "rreag") { &store_wrongattempts();#Call subroutine to store tries &pgeTop(); print "
Incorrect answer, please try again. This is Ronald Reagan. To find out more about President Reagan visit the Ronald Reagan Home Page.
Please go back to the original question.
\n"; print "
\n"; &pgeBottom(); } elsif($answer1 eq "usg") { &store_wrongattempts();#Call subroutine to store tries &pgeTop(); print "
Incorrect answer, please try again. This is Ulysses S. Grant. To find out more about President Grant, visit this Ulysses S. Grant page.
Please go back to the original question.
\n"; print "
\n"; &pgeBottom(); } } #******************QUESTION SIX RESPONSES****** sub sixthsetofresponses { if($answer1 eq "ghs"){ &store_correctattempts();#call subroutine that stores value for correct &check_attempts();#call subroutine that checks number of attempts in order &clear_attempts();#clears attempts so that start fresh with next question &pgeTop(); print "
\n"; print "
Harry's High School graduating class

\n"; print "Harry S. Truman graduated from Independence (MO) High School with the class of 1901. Harry is in the back row fourth from the left. Also, graduating with Harry was Charlie Ross (front row, first on left) who later became his press secretary and Bess Wallace (second row, far right) who later became his wife. Even though Harry did not graduate from college, he was extremely well read and taught himself far beyond the level of most high school graduates.\n"; print "

\n"; &pgeBottom(); } elsif($answer1 eq "gf") { &store_wrongattempts();#Call subroutine to store tries &pgeTop(); print "
Incorrect answer, please try again. This is Gerald Ford. To find out more about President Ford visit the White House web site..
Please go back to the original question.
\n"; print "
\n"; &pgeBottom(); } elsif($answer1 eq "gb") { &store_wrongattempts();#Call subroutine to store tries &pgeTop(); print "
Incorrect answer, please try again. This is George Bush. To find out more about President Bush visit the White House web site.
Please go back to the original question.
\n"; print "
\n"; &pgeBottom(); } elsif($answer1 eq "zit") { &store_wrongattempts();#Call subroutine to store tries &pgeTop(); print "
Incorrect answer, please try again. This is Zachary Taylor. To find out more about President Taylor visit the White House web site.
Please go back to the original question.
\n"; print "
\n"; &pgeBottom(); } } #******************QUESTION SEVEN RESPONSES****** sub seventhsetofresponses { if($answer1 eq "capharry"){ &store_correctattempts();#call subroutine that stores value for correct &check_attempts();#call subroutine that checks number of attempts in order &clear_attempts();#clears attempts so that start fresh with next question &pgeTop(); print "
\n"; print "
Harry in military uniform

\n"; print "Harry Truman was past the eligible drafting age (33 years old) when the United States entered World War I. Being the sole provider for his family and having poor eyesight, Harry would not have had to serve in WWI. However, '...being stirred heart and soul' by President Wilson's call to arms, he volunteered anyway. He rejoined the National Guard and was immediately elected first lieutenant by his company. He was transferred to France and became a captain, where he transformed his 129th Field Artillery Battery into one of the best in France. After the war ended, Harry returned to the United States.\n"; print "

\n"; &pgeBottom(); } elsif($answer1 eq "de") { &store_wrongattempts();#Call subroutine to store tries &pgeTop(); print "
Incorrect answer, please try again. This is Dwight Eisenhower. To find out more about President Eisenhower visit the White House web site.
Please go back to the original question.
\n"; print "
\n"; &pgeBottom(); } elsif($answer1 eq "ug") { &store_wrongattempts();#Call subroutine to store tries &pgeTop(); print "
Incorrect answer, please try again. This is Ulysses S. Grant. To find out more about President Grant visit the White House web site.
Please go back to the original question.
\n"; print "
\n"; &pgeBottom(); } elsif($answer1 eq "zt") { &store_wrongattempts();#Call subroutine to store tries &pgeTop(); print "
Incorrect answer, please try again. This is Zachary Taylor. To find out more about President Taylor visit the White House web site.
Please go back to the original question.
\n"; print "
\n"; &pgeBottom(); } } #******************QUESTION EIGHT RESPONSES****** sub eighthsetofresponses { if($answer1 eq "manyjobs"){ &store_correctattempts();#call subroutine that stores value for correct &check_attempts();#call subroutine that checks number of attempts in order &clear_attempts();#clears attempts so that start fresh with next question &pgeTop(); print "
\n"; print "
Harry in his store

\n"; print "In November, 1919, Harry Truman and Eddie Jacobson opened a menswear shop at 104 West 9th Street in Kansas City, Missouri. Harry and Eddie had been army buddies in Battery D of the 129th Field Artillery during World War I. At Camp Doniphan, Oklahoma, they had operated a successful canteen. Their post-war partnership in the haberdashery was prosperous for two years. Then an agricultural depression contributed to economic problems, and the partners closed their shop in 1922. For the next fifteen years, Harry paid off debts incurred from their venture.

\n"; print "
\n"; &pgeBottom(); } elsif($answer1 eq "ww") { &store_wrongattempts();#Call subroutine to store tries &pgeTop(); print "
Incorrect answer, please try again. This is Woodrow Wilson. To find out more about President Wilson visit the White House web site.
Please go back to the original question.
\n"; print "
\n"; &pgeBottom(); } elsif($answer1 eq "howie") { &store_wrongattempts();#Call subroutine to store tries &pgeTop(); print "
Incorrect answer, please try again. This is William Howard Taft. To find out more about President Taft visit the White House web site.
Please go back to the original question.
\n"; print "
\n"; &pgeBottom(); } elsif($answer1 eq "jc") { &store_wrongattempts();#Call subroutine to store tries &pgeTop(); print "
Incorrect answer, please try again. This is Jimmy Carter. To find out more about President Carter visit the White House web site.
Please go back to the original question.
\n"; print "
\n"; &pgeBottom(); } } #******************QUESTION NINE RESPONSES****** sub ninthsetofresponses { if($answer1 eq "countyjudge"){ &store_correctattempts();#call subroutine that stores value for correct &check_attempts();#call subroutine that checks number of attempts in order &clear_attempts();#clears attempts so that start fresh with next question &pgeTop(); print "
\n"; print "
Truman being sworn in as presiding judge of Jackson County, 1931.

\n"; print "Encouraged by the Pendergast political machine, Harry was elected a county judge and became well known for his integrity and diligence. During his eight years as presiding judge, he had the chief responsibility of expending \$60,000,000 in tax funds and bond issues in Jackson County, Missouri. He was noted for building a modern road system throughout the county. In 1934, Truman was elected to the U.S. Senate and was a New Dealer from the start. He was re-elected by a close margin in 1940 and continued to be a productive member of the Senate until he was Franklin Roosevelt's surprise choice for Vice President in 1944.\n"; print "

\n"; &pgeBottom(); } elsif($answer1 eq "rn") { &store_wrongattempts();#Call subroutine to store tries &pgeTop(); print "
Incorrect answer, please try again. This is Richard Nixon. To find out more about President Nixon visit the White House web site.
Please go back to the original question.
\n"; print "
\n"; &pgeBottom(); } elsif($answer1 eq "mb") { &store_wrongattempts();#Call subroutine to store tries &pgeTop(); print "
Incorrect answer, please try again. This is Martin Van Buren. To find out more about President Van Buren visit the White House web site.
Please go back to the original question.
\n"; print "
\n"; &pgeBottom(); } elsif($answer1 eq "grover") { &store_wrongattempts();#Call subroutine to store tries &pgeTop(); print "
Incorrect answer, please try again. This is Grover Cleveland. To find out more about President Cleveland visit the White House web site.
Please go back to the original question.
\n"; print "
\n"; &pgeBottom(); } } #******************QUESTION TEN RESPONSES****** sub tenthsetofresponses { if($answer1 eq "sweet"){ &store_correctattempts();#call subroutine that stores value for correct &check_attempts();#call subroutine that checks number of attempts in order &clear_attempts();#clears attempts so that start fresh with next question &pgeTop(); print "
\n"; print "
Wedding picture

\n"; print "Harry S. Truman wed Bess Wallace on June 28, 1919 after pursuing her for most of his life. In his personal writings Harry mentions several times that he fell in love with the 'beautiful fair-haired girl' in elementary school.

The wedding party consists of front row left to right Hellen Wallace ( Mrs. Truman's cousin); Harry Truman; Bess Truman; Louise Wells (married name Mrs. Lee Hull) Back row: Ted Marks and Frank Wallace.\n"; &compute_finalscore(); &output_finalscore(); &pgeBottom(); &clear_scores(); } elsif($answer1 eq "wilmc") { &store_wrongattempts();#Call subroutine to store tries &pgeTop(); print "

Incorrect answer, please try again. This is William McKinley. To find out more about President McKinley visit the White House web site.
Please go back to the original question.
\n"; print "
\n"; &pgeBottom(); } elsif($answer1 eq "frankrose") { &store_wrongattempts();#Call subroutine to store tries &pgeTop(); print "
Incorrect answer, please try again. This is Franklin Roosevelt. To find out more about President Roosevelt visit the White House web site.
Please go back to the original question.
\n"; print "
\n"; &pgeBottom(); } elsif($answer1 eq "grcl") { &store_wrongattempts();#Call subroutine to store tries &pgeTop(); print "
Incorrect answer, please try again. This is Grover Cleveland. To find out more about President Cleveland visit the White House web site.
Please go back to the original question.
\n"; print "
\n"; &pgeBottom(); } } #**********************SUBROUTINE THAT OUTPUTS PAGE TOP***************** sub pgeTop { print "Content-type: text/html\n\n"; print " Results\n"; print "\n"; print "\n"; output_nav(); print "

\n"; } #**********************SUBROUTINE THAT OUTPUTS PAGE BOTTOM***************** sub pgeBottom { print "\n"; print "\n"; } #**********************SUBROUTINE THAT OUTPUTS ERROR BOTTOM***************** sub pgeErrBottom { print "\n"; print "\n"; } #**********************SUBROUTINE THAT OUTPUTS ERROR MESSAGE***************** sub errmessage { print "

Error

        The question was left blank.

Please:

1) Press the back button on your browser to return to the question. 2) Complete it. 3) Press the Submit Answer button

Thank you.

\n"; } #************Subroutine outputs user tries to file called attempts**** sub store_wrongattempts { open(MYFILE,">>attempts"); print MYFILE "1\n"; close(MYFILE); } sub store_correctattempts { open(MYFILE,">>attempts"); print MYFILE "0\n"; close(MYFILE); } #**********************SUBROUTINE THAT CHECKS ATTEMPTS AND COMPUTES INTERIM SCORE******** sub check_attempts { open(IN,"attempts");#open file called attempts to check user tries @attempts = ; #read the number of tries into an array #Add user attempts foreach $attempts(@attempts) { $user_tries = $attempts + $user_tries; } close(IN); if($user_tries == 0) { $score = 4; } elsif($user_tries == 1) { $score = 3; } elsif($user_tries == 2) { $score = 2; } elsif($user_tries == 3) { $score = 1; } open(OUT,">>scores"); print OUT "$score\n"; close(OUT); } sub clear_attempts { open(OUT,">attempts"); print OUT "\n"; close(OUT); } #******************************SUBROUTINE THAT COMPUTES FINAL SCORE***** sub compute_finalscore { open(IN, "scores"); @finalscore = ; #read the number of tries into an array #Compute final score foreach $finalscore(@finalscore) { $user_finalscore = $finalscore + $user_finalscore; } close(IN); } #*********************SUBROUTINE THAT PRINTS FINAL SCORE**************** sub output_finalscore { print "

Your score is $user_finalscore. Thank your for playing Where's Harry?

\n"; } #**********************SUBROUTINE THAT CLEARS THE SCORES FILE FOR NEXT USER******** sub clear_scores { open(OUT, ">scores"); print OUT "\n"; close(OUT); } #************************OUTPUT TRUMAN HEADER********************************************* sub output_nav { print "
\"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\"
\"\" \"\"
\"\" \"\"
"; }