Colonel Gray High School

Home
ITC401
CMP521
General Resources

Programming

If you wish to use the program at home, create a folder called C:\qbasic and download QBasic executable and Help File to that folder.

Task 1 - Understanding the Basics

This document contains basic information regarding Qbasic.  Please read the content very carefully and try the examples.  You should try to complete about 6-8 pages of the document per period.

Instructions

  1. Using Maintain your Files, create a new folder called programming
  2. Download a copy of qbasic_notes.wpd to your D:\ drive
  3. Navigate to your student group in UserNet
  4. Open Qbasic
  5. On the Menu bar, choose Options | HelpPath
  6. In the help path, key - s:\spcain\cmp521a - You may need to reset this each day for a while until we get a more permanent solution
  7. Open WordPerfect and navigate to the D:\ drive and open the file qbasic_notes.wpd
  8. Work through the content by reading and trying examples

Assignments

After you have read the notes and tried the examples, you may try the assignment.  Follow the instructions in each assignment.  Please maintain your planning forms for each assignment that you complete as you will be asked to hand this is with your code for classmarks.  Please complete these assignment in order.  A print of your code and the planning sheet needs to be handed in before you move to the next assignment.

Assignment 1

Have a look at this sample use of a subroutine that you can use to structure your program.

sample_sub_routine_program.pdf

qbasic_assignment_01.pdf

Assignment 2

qbasic_assignment_02.pdf

Assignment 3

qbasic_assignment_03.pdf

Assignment 4

qbasic_assignment_04.pdf

Assignment 5

qbasic_assignment_05.pdf

Assignment 6

example_case_select.pdf

qbasic_assignment_06.pdf

Assignment 7

qbasic_assignment_07.pdf

Assignment 8 - Optional Challenge

Bingo Machine

You have been asked to create a Bingo machine that will pick the numbers for the Bingo and display them on the screen one at a time as the Bingo caller requests the next number.

Requirements

bulletPlanning Form
bulletHeader
bulletVariables
bulletUse sub routines
bulletYou must not display the same number twice
bulletThe user must be able to control when the next number is generated by pressing the "N" key - look at the INKEY$ command
bulletTell the user some information on how to use the BINGO machine works
bulletAs each number is generated, evaluate the letter of Bingo that the number falls into.  BINGO - B = 1 to 15, I = 16 to 30, N = 31 to 45, G = 46 to 60, O = 61 to 75
bulletHave a print statement that says something like "Under the B, number 4" after the key is pressed.
bulletYou can dress it up after you get the main functionality handled

Assignment 9 - Holiday Turkey Cooker

You need to design a program that will calculate the time required to cook a turkey.  Note - This values may not be absolutely correct so don't use this to calculate the cooking times for your own turkey.

What you need to do:

Use sub routines for input, calculations, and display

No need to use a planning form

  1. Have the user enter the the mass in kilograms since this is the unit of the label
  2. Convert the kilograms to lbs using the conversion factor of 1 kg = 2.2 lbs
  3. If it takes 18 minutes for each pound, then write an output statement that says the amount of time broken out into hours and minutes.  This is the hardest part of the problem.  Hint.  You will need to use the INT command.

Example: It takes 4 hours and 15 minutes to cook a 22 lbs turkey

Assignment 10 - Calorie Burner

You need to design a program that will calculate the amount of kilometres that a user will have to run for in order to burn off the calories consumed  in a certain number of slices of pizza.

bulletallow the user to enter the number of pizza slices
bulletpizza slice = 350 calories
bulletcalories burned per kilometre run = 120

calculate the length of distance in kilometres that you would have to run to burn off the calories and display the result.  Example:

You would have to run x kilometres to burn off y calories contained in z slice(s) of pizza