19.04.2017 Views

Learn to Program with Small Basic

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2. Write a science quiz that tests the student’s knowledge of the animal<br />

kingdom. First, use Notepad <strong>to</strong> create the following text file:<br />

1=Invertebrates;2=Fish;3=Amphibians;4=Reptiles;5=Birds;6=Mammals<br />

Bat;6<br />

Clam;1<br />

Dog;6<br />

Frog;3<br />

Lizard;4<br />

Peacock;5<br />

Salamander;3<br />

Salmon;2<br />

Spider;1<br />

Turkey;5<br />

Turtle;4<br />

The first line contains the possible classifications. Each of the<br />

remaining lines contains an animal’s name and its correct classification.<br />

Display an animal’s name <strong>to</strong> the player, and then ask them <strong>to</strong><br />

classify that animal by entering the number of the correct class. Then<br />

process the player’s answer and let them know whether their answer is<br />

correct; if their answer is incorrect, display the correct classification.<br />

306 Chapter 19

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!