The name of this assignment refers to a programming tradition - that your first program in any new language will display the words Hello World on the screen. The ECOS programming course is going to use BASIC, but the actual language doesn't matter as much as the ideas that make up your program. Once you understand how to program, it is fairly easy to swap between languages. Or, if you don't want to swap, you can move on to Microsoft Visual Basic, which is used for Office macros, ASP and ASP.net web-pages and full-blown Windows applications. BASIC isn't basic, it's an acronym - Beginners' All-Purpose Symbolic Instruction Code.
We are going to start by using a type of BASIC called Just BASIC, which is a small, free download...
The Just BASIC programming environment can be downloaded from the Just BASIC download page.
Open the place, click the link and install Just BASIC by running the file that you download. It should only take a few seconds.
The Just BASIC user interface looks like this:
It's pretty straightforward to use. You type your program in the main window, you click the blue triangle button to run your program, and the results appear in a pop-up window. You can use the File menu to save your program or open one that you made early, or you should be able to double-click a file that's already been saved.
Here are just a few useful commands to get you started - it's more than you'll need for this task:
PRINT - text needs to be put in speech marks, e.g. PRINT "Hello", numbers don't, e.g. PRINT 10 or PRINT A (where A is a variable). Putting a semi-colon (;) at the end of the print command - e.g. PRINT "Hello"; - will cause the next thing that you print to carry on on the same line.
INPUT - e.g. INPUT "What is your name? "; A$ will ask the question and store the answer in the variable called A$
FOR - repeats a section of your program a number of times - e.g. FOR N = 1 TO 10 will repeat 10 times, counting with N from 1 to 10. If you don't want to count in 1s, you can add STEP - e.g. FOR N = 5 TO 100 STEP 5 (to count up to 100 in 5s) or FOR N = 10 TO 1 STEP -1 (to count from 10 down to 1). You don't need to use N - it's just a programmers habit, like using x in algebra; any valid variable name will do.
FOR N = 1 TO 10
will print the word Hello ten times.
Comments - these are lines in your program that don't do anything. They are like labels and are usually use to remind you (or someone else looking at your program) what it does. Any line that begins with an apostrophe is treated as a comment, e.g. ' My First Program.
NB. You will only need the PRINT command and comments for this assignment. Note also that I have used capital letters for the commands to make them stand out - they don't need to be written in capitals.
Being by downloading my sample program - HelloWorld.bas. Click the right-mouse button on the link and save it into your My Documents (or wherever you keep your ECOS work) and double-click it to open it in Just BASIC. NB. If you just click the link, the file will probably just open in your browser.
All I'm asking for this first assignment is for you to edit the program so that it prints information relevant to you. You will also learn how to open, save and run your programs. If you want to experiment and add extra features, then feel free!
Your program should:
display your name instead of Joe Bloggs. Make sure that your name includes spaces!
show the current day
The commands that display Hello Joe Bloggs are spread over three lines of the program - can you see why they still display the message all on one line? Do you think that there would be a simpler (or more efficient way to write this program)?