CodeCooker Home Page


QuickBasic Tip Sheets

Sheet 1 - Intro to QuickBasic vaiables, color, sound, and loops
Sheet 2 - Strings

Assignments - First Semester
Name Description Language(s) Concepts Learned Other Requirements
Calculator Program Write a program that functions as a mathematical calculator. The calculator will have the following math functions:
  • addition
  • subtraction
  • multiplication
  • division
  • board-foot calculations
  • temperature conversions

Note, when you do the boardfoot calculation, allow the user to enter the dimensions in a mix of feet and inches if they wish. Ask them these seven questions, in this order:
  • How many pieces
  • What is the length?
  • Was that in feet of inches
  • What is the width?
  • Was that in feet of inches
  • What is the thickness?
  • Was that in feet of inches
If they enter any dimension in feet, convert it to inches. Then use this formula to calculate the total boardfeet:

boardfeet = (pieces * length * width * thickness) / 144

For temperature conversion, use these formulas:

celsius = 5/9 * (fahrenheit - 32)

fahrenheit = (9/5 * celsius) + 32



QuickBasic
  • Screen output with PRINT and LOCATE
  • use of variables, both numeric and string
  • the INPUT statement
  • the IF/THEN structure
  • the use of GOTO and Labels
  • math functions and syntax
  • the DO Loop and INKEY$
For extra credit, include additional math functions.

An example calculator program is available here.

Another example calculator program is available here.

Sound Library Write a menu-driven program that functions as a library of various sound effects. Model the structure of the program similar to the calculator program.

Use the SOUND statement with a FOR / NEXT loop for at least 6 of the sounds.

QuickBasic
  • A menu of sound effects available
  • At least 10 sound effects
  • Single keystroke operation

Hi-Lo Game The program plays a number guessing game. If the user does not guess the number, the program tells them if they are too high or too low. The program will have the following features:
  • a title or splash screen showing the name of the program and your name
  • demonstrate animation in four directions
  • the use of color
  • the use sound
  • the use of animation
  • differing levels of play
QuickBasic
  • introduction to the FOR/NEXT loop
  • SOUND and COLOR statements
  • introduction to the DO Loop and INKEY$
  • the TIMER statement
 
The Leap Year Program Write a program that determines whether a single or a range of years is a leap year in the Gregorian Calendar. The program will have the following features:
  • show the current date and time on the screen, along with your name
  • the time should be "ticking," that is, it should be running as long at the program waits at the menu screen
  • a menu to choose single year, range of years, or to quit
  • a check that it does not calculate leap years before there were leap years (1582)
  • when listing a range of years, stop the list before it scrolls off the screen and wait for user input
  • when listing a range of years, show all the years and whether each is or is not a leap year
  • when the user enters the range years, make sure that the starting year is less than the ending year or provide for the loop to run backwards
Be sure to "user proof" your program.
QuickBasic
A working sample of the program is here.

The Calendar presentation is here.

Introduction to String Processing You will write a program that allows the user to enter their first and last name on one line, separated by a space. They will then be asked to enter a sentence. Your program will then provide the output as shown below in the sample run. User input is shown in red.


What is your first and last name? Abraham Lincoln

Enter a sentence: The cat in the hat

Enter a search word that is in that sentence: cat

Here are the results:

Your first name is: Abraham

Your last name is: Lincoln

Your name in all upper case is: ABRAHAM LINCOLN

Your name backwards is: nlocniL maharbA

The search word first appears in the sentence in position: 5

The number of words in the sentence is: 5



For extra credit, convert the sentence into ROT13.

If you do this option, you will be required to explain, in detail, how your code works.



The sentence in ROT13 is: Gur png va gur ung




For extra, extra credit, convert the sentence into Pig Latin.

If you do this option, you will be required to explain, in detail, how your code works.



The sentence in ROT13 is: Ethay atcay inway ethay athay




Click here for a Quick Basic Strings Tip Sheet.
Be sure to "user proof" your program.
QuickBasic A sample program is here.
Digital Clock You will write a program that functions as a digital clock that displays the following

The current time in this format:

 6 hours
12 minutes
36 seconds

Show whether it is AM or PM

When the hour, minute, or second is equal to 1, indicate the singular, not the plural.

When the hour, minutes, or second is less than 10, do not print the leading zero but replace it with a space to keep the words "hours," "minutes," and "seconds" lined up vertically.

The clock should be "running" until the user presses the Escape key.



And the date in this format:

October 14, 2008


Use Screen 1 for your display. Use the extended ASCII character set to create a border.

QuickBasic DATE$
TIME$
Click here for a sample picture.

The clock will be "ticking" that is, running with the time changing, while the program runs.
The President Program Write a program that shows all the US presidents, terms served, years lived, party affiliation, and vice-president. The features include:
  • a menu with choices to list the data as follows:
    • all the presidents
    • by last name
    • by party
    • by number
  • when listing more information that will fit on a single screen, pause the listing and wait for user input
  • when searching by party, provide the user with a menu of parties to chose from
  • all menus should function by single keystrokes. Do not require the user to press the Enter key.

QuickBasic
  • the OPEN statement with Append, Output, and Input modes
  • the INPUT # statement
  • the PRINT # statement
  • the WRITE # statement
  • the CLOSE statement
There is a sample program here.

The notes from the classroom presentation on this topic are here in PDF format.

The data file, in CSV format, containing the president information is downloadable here

Web Site Development
Web Site Development Your assignment is to create an instructional/how-to web site for a fictious online education company. The topic of your site is up to you but must be approved by your teacher.

A web site will instruct the user how to do something by showing and explaining the steps in the process. The site will have an online quiz to tests the user's knowledge.

The web site will contain a minimum of four separate pages (five if you count the one generated by PHP-driven quiz)

Contents of Page 1
  • a company logo designed by you
  • an additional image used as a navigation button
  • a complete description of the your company
  • a complete list of topics on the site (even though you will only be developing one of them)
  • contact information: phone, fax, email
  • links to related sites
  • the date that the page was built or revised

Contents of Page 2
  • a description of the topic and a materials list (photos if necessary)
Contents of Page 3
  • the step-by-step process for completing the process of your topic
Contents of Page 4
  • a multiple choice quiz about your topic process
  • you will have a text box for the user to enter their name
  • you will have a pull-down options menu for the user select their grade (9-12)
  • you must have ten questions and four choices per question
  • your quiz will use the proper <form> variables to work with the supplied PHP program
  • for guidelines in creating your quiz form, click here.
  • you must pass the name of your company and the topic of the quiz to the PHP program using the hidden input types
Contents of Page 5
  • this page is generated by a PHP program (that you do not have to write) that shows the results of the quiz
  • the source code for this program can be downloaded here
  • you will need to rename the PHP program "quiz.php" and upload it to your web site

Your web site will also be evaluated on the following:

  • followed the instructions above for what goes on what page
  • demonstrate that you know how to use tables
  • attractive layout
  • easy to read (text does not conflict with background, etc.)
  • spelling
  • proper HTML including "title" in your image tags (Use a web page validator like Dr. Watson)
  • functional quiz

Keep in mind that ther content of your site must be of your own creation. You are allowed to use clip art and photos as will be explained in class.

All images must contain an annotation in the HTML source code that contains a direct link to their source. For example,

<img src="sunrise.jpg">
<!-- http://openphoto.net/gallery/image.html?image_id=6704 -->

or if the image was created by you,

<img src="mylogo.gif">
<!-- Created by me using The Gimp -->




HTML
CSS
PHP
  • the HyperText Markup Language
  • designing computer graphics for the web: JPGs and GIFs
  • page layout techniques
  • advanced techniques: TABLEs and FRAMEs
  • building forms and introduction to PHP
  • introduction to StyleSheets
  • using an FTP client to transfer your web page to the web server
Helpful Links

Sample Business Page - Focus Software Development

Sample Business Page - Polka Dot Software

HTML Goodies - HTML Tutorials

Webmonkey - HTML Color Codes

Media Builder - Clip Art and Backgrounds

Microsoft Office Clip Art - Clip Art and Backgrounds

Open Photo - Photographs to use

Open Clip Art - Clip Art to use

Creative Commons - Photographs to use


How to A to Z - Your teacher's how to do it site

PHP Quick Reference

Pagan's Pizza - form processing example

Order form PHP - example of extracting and echoing form data with PHP

Another order form/PHP demo - This one is a flower shop

How to build HTML forms


Robotics Programming
Robotics Learn how robots are programmed to perform a variety a tasks.
LabVIEW
For a list of your assignments, click here.
The Game Project
The Game Project


Using SmallBasic, you will create a game. The game is called Connect 4 and is similar to Tic-Tac Toe. We will go through the SmallBasic tutorials and then build the game step-by-step.

Tutorials

Complete these chapters in the SmallBasic Tutorial:
Day 1 - Chapters 1 - 4
Day 2 - Chapters 5 - 7
Day 3 - Chapters 9 - 11
Look at the resource in the column to the right for more information about programming in SmallBasic.

Now you will begin building the game. The steps are listed below. You will receive points for each of the completed steps.

Step 1 - Create the title screen

Set up the graphics window and build a title/introduction screen. That screen will show the name of the game, your name, game version number, and the date (month and year), and a prompt to tell the user how to start the game.
The graphics screen window size should be set to

GraphicsWindow.Width = 480
GraphicsWindow.Height = 320


Step 2 - Set up the game board

Create the game board screen. The board will consist of 6 rows and 7 columns. You can use any shape you want to create the board. Leave an area on the board to display the game title, instructions, and an indication as to whose turn it is.

Here is an example of a game board:


Step 3 - Create the player's piece

Create Player One's piece. This should appear above the first column on the left. Allow the player to move the piece from above one column to another with the use of the arrow keys. The piece should not move anywhere other than over the columns.

Step 4 - Drop the piece

Allow the player to drop their piece when they press the Enter key. The piece should drop from one row to another, stopping at the bottom of the column.

Step 5 - Switch players

Once Player One has dropped their piece, switch to Player Two. A different piece should appear above the column on the left. This piece should look different from Player One's piece. Player Two should be able to move the piece across the space above the columns as Player One did with their piece.

Step 6 - Drop the second piece

This is the same action as when Player One dropped their piece EXCEPT that now, instead of just dropping to the bottom row, you have to drop to the last unoccupied space in that column. So, if Player Two drops into the same column as Player One did, Player Two's piece would need to stop in Row 5.

Step 7 - Continuing the play

After Player two makes their play, switch back to Player One. Then back to Player Two, and so on. You should be able to fill the board with Player One and Player Two pieces. Step 8 - Checking for a win

Once you have the game functioning through Step 7, you need to add a checker that determines whether either player has a Connect 4 after each of their moves. You will need to test for a four-in-a-row that can occur horizontally, vertically, and in two diagonal directions. If a player has 4-in-a-row, then you will indicate which player won and the game will stop.

Step 8 - Checking for a draw

If all the spaces on the board are used and neither player has a Connect 4, then the game is a draw and you will display that on the screen and the game will stop.

Step 9 - Starting over

After a win or a draw, provide a feature that lets the player start another game or to quit.

SmallBasic
Your code must be annotated, that is, include remarks in your program code that indicate what that portion of the program does.



Here is a beta version of my game.

You might need the SmallBasicLibrary.dll to run it. Download here.

Other SmallBasic Resources

SmallBasic Reference

Fun Programming for Kids

Introducing SmallBasic





CodeCooker Home Page

This page created in December 2002.
Last update December 2011