locked
Writing Code RRS feed

  • Question

  • completly new to programming trying to learn on small basic, i have been hiven a task to do and i do not know where to start, help please, the task is to code a sytem that can accept a password then test the password for:-

    minimum of 6 characters and max 12, be able to display a message saying if the password has failed and why

    a message to say if it has been accepted

    the code needs to be able to access the strength of the password, wher upper case, lower case and numbers are to be used

    eg weak if only lower case or only numbers used

    medium if two types are used

    strong if three types are used

    
    
    
    
    
    Monday, September 9, 2013 8:55 PM

Answers

  • If these are both OK, then

    Some Basics:

    Programming tells the computer what to do.  We type them into a text editor and when we want to run it, the words we have written are turned into instructions the computer can execute - this is called compiling (turn the words of program into computer instructions).  Most programmers never bother with these instructions which are just very basic instructions for the cpu, they just use the words of the programming language they are using.  The words are called your program or source code.

    While the computer is very fast, it is stupid - it only does what you tell it to do, nothing more and nothing less.  If your program doesn't work it is almost always your fault.  We all make mistakes and this is fine, it is how we learn.  Also it is good because it is completely logical and we can work out where the problem is (debug the program), the computer never has a bad day!

    You cannot damage anything by just trying stuff in Small Basic - it may not work, but no harm done.  The one exception in Small Basic is the File Object (you could delete files - so stay away from this to start with).

    The language you type your code in has some main features:

    1] Keywords - these control the logic of the program such as loop (repeat something For or While) or conditional (branch where the program goes depending on the value of a variable - If), define a subroutine (Sub) etc - they are colored blue in Small Basic.

    2] Variables - these are names given to things we use and store and do things with - think of them like draws that we can put things in and store these things while we do stuff with them.  These are black in Small Basic.

    3] Literals - (orange)  Values that are not stored in variables, like a number 3.14 or set of characters in quotes "Hi There!".

    4] Objects - these are special functions that have been provided to do certain things, like add a picture to a display.  These are light green and there are several of them in Small Basic, like TextWindow, Clock etc.

    5] Methods, Parameters and Events (dark red) - these are found for the different objects by typing a dot after the object.  They do the special things - they may also need some data to work with (called parameters) or return some data.

    6] Comments - (green) anything after a ' (single quote) is not read by the compiler it is just comments for you to remember what you did or why - make good use of these.

    There are plenty more we could say about all these, but this is plenty to be getting on with.  The key is to learn by doing, like playing a sport or musical instrument.

    Small Basic only has a small set of keywords, objects and methods compared to most languages which makes it easier to get started.

    The first program we usually write in any language is the 'hello world' program that writes this out.

    In Small Basic, this is:

    TextWindow.WriteLine("hello World")

    TextWindow is an Object
    WriteLine is a Method, the brackets show that this method needs some data to work with - what to write.
    "Hello World" is what we want the write and it is put in double quotes - and is called a literal since it is not a variable, but is just a value (not in a draw).

    We then run the program (we can save it first if we want) and the computer converts it into instructions for the computer and then does it.

    Now, do the Hello World program, follow the getting started guide and ask questions (with your code).

    Good luck.

    Tuesday, September 10, 2013 7:39 PM

All replies

  • Pretty much everything in this post applies.

    What have you got so far?  Have you studied and used the Text object or written any other programs yet?

    Monday, September 9, 2013 9:15 PM
  • total beginner

    Tuesday, September 10, 2013 6:20 PM
  • i can place a message on screen and thats about it
    Tuesday, September 10, 2013 6:28 PM
  • 1] I assume you have installed Small Basic and can start it.

    2] Did you find the getting started guide? 

    It is a pdf  in Start->All Programs->Small Basic->Introducing Small Basic. This is the best place to start.

    Please confirm that you have the 2 points above OK.  If so, then we can progress.

    Tuesday, September 10, 2013 6:29 PM
  • If these are both OK, then

    Some Basics:

    Programming tells the computer what to do.  We type them into a text editor and when we want to run it, the words we have written are turned into instructions the computer can execute - this is called compiling (turn the words of program into computer instructions).  Most programmers never bother with these instructions which are just very basic instructions for the cpu, they just use the words of the programming language they are using.  The words are called your program or source code.

    While the computer is very fast, it is stupid - it only does what you tell it to do, nothing more and nothing less.  If your program doesn't work it is almost always your fault.  We all make mistakes and this is fine, it is how we learn.  Also it is good because it is completely logical and we can work out where the problem is (debug the program), the computer never has a bad day!

    You cannot damage anything by just trying stuff in Small Basic - it may not work, but no harm done.  The one exception in Small Basic is the File Object (you could delete files - so stay away from this to start with).

    The language you type your code in has some main features:

    1] Keywords - these control the logic of the program such as loop (repeat something For or While) or conditional (branch where the program goes depending on the value of a variable - If), define a subroutine (Sub) etc - they are colored blue in Small Basic.

    2] Variables - these are names given to things we use and store and do things with - think of them like draws that we can put things in and store these things while we do stuff with them.  These are black in Small Basic.

    3] Literals - (orange)  Values that are not stored in variables, like a number 3.14 or set of characters in quotes "Hi There!".

    4] Objects - these are special functions that have been provided to do certain things, like add a picture to a display.  These are light green and there are several of them in Small Basic, like TextWindow, Clock etc.

    5] Methods, Parameters and Events (dark red) - these are found for the different objects by typing a dot after the object.  They do the special things - they may also need some data to work with (called parameters) or return some data.

    6] Comments - (green) anything after a ' (single quote) is not read by the compiler it is just comments for you to remember what you did or why - make good use of these.

    There are plenty more we could say about all these, but this is plenty to be getting on with.  The key is to learn by doing, like playing a sport or musical instrument.

    Small Basic only has a small set of keywords, objects and methods compared to most languages which makes it easier to get started.

    The first program we usually write in any language is the 'hello world' program that writes this out.

    In Small Basic, this is:

    TextWindow.WriteLine("hello World")

    TextWindow is an Object
    WriteLine is a Method, the brackets show that this method needs some data to work with - what to write.
    "Hello World" is what we want the write and it is put in double quotes - and is called a literal since it is not a variable, but is just a value (not in a draw).

    We then run the program (we can save it first if we want) and the computer converts it into instructions for the computer and then does it.

    Now, do the Hello World program, follow the getting started guide and ask questions (with your code).

    Good luck.

    Tuesday, September 10, 2013 7:39 PM
  • working through the guide and it is making sense, just doing the name entry task and i am beginning to see how my password task oabove coulld be solved, that means i am about to get completely lost we will see
    Tuesday, September 10, 2013 8:18 PM
  • well done - please ask any questions if you get stuck (with your code).
    Tuesday, September 10, 2013 8:22 PM
  • thanks i will

    Tuesday, September 10, 2013 8:39 PM
  • If these are both OK, then

    Some Basics:

    Programming tells the computer what to do.  We type them into a text editor and when we want to run it, the words we have written are turned into instructions the computer can execute - this is called compiling (turn the words of program into computer instructions).  Most programmers never bother with these instructions which are just very basic instructions for the cpu, they just use the words of the programming language they are using.  The words are called your program or source code.

    While the computer is very fast, it is stupid - it only does what you tell it to do, nothing more and nothing less.  If your program doesn't work it is almost always your fault.  We all make mistakes and this is fine, it is how we learn.  Also it is good because it is completely logical and we can work out where the problem is (debug the program), the computer never has a bad day!

    You cannot damage anything by just trying stuff in Small Basic - it may not work, but no harm done.  The one exception in Small Basic is the File Object (you could delete files - so stay away from this to start with).

    The language you type your code in has some main features:

    1] Keywords - these control the logic of the program such as loop (repeat something For or While) or conditional (branch where the program goes depending on the value of a variable - If), define a subroutine (Sub) etc - they are colored blue in Small Basic.

    2] Variables - these are names given to things we use and store and do things with - think of them like draws that we can put things in and store these things while we do stuff with them.  These are black in Small Basic.

    3] Literals - (orange)  Values that are not stored in variables, like a number 3.14 or set of characters in quotes "Hi There!".

    4] Objects - these are special functions that have been provided to do certain things, like add a picture to a display.  These are light green and there are several of them in Small Basic, like TextWindow, Clock etc.

    5] Methods, Parameters and Events (dark red) - these are found for the different objects by typing a dot after the object.  They do the special things - they may also need some data to work with (called parameters) or return some data.

    6] Comments - (green) anything after a ' (single quote) is not read by the compiler it is just comments for you to remember what you did or why - make good use of these.

    There are plenty more we could say about all these, but this is plenty to be getting on with.  The key is to learn by doing, like playing a sport or musical instrument.

    Small Basic only has a small set of keywords, objects and methods compared to most languages which makes it easier to get started.

    The first program we usually write in any language is the 'hello world' program that writes this out.

    In Small Basic, this is:

    TextWindow.WriteLine("hello World")

    TextWindow is an Object
    WriteLine is a Method, the brackets show that this method needs some data to work with - what to write.
    "Hello World" is what we want the write and it is put in double quotes - and is called a literal since it is not a variable, but is just a value (not in a draw).

    We then run the program (we can save it first if we want) and the computer converts it into instructions for the computer and then does it.

    Now, do the Hello World program, follow the getting started guide and ask questions (with your code).

    Good luck.

    Wow. Could this become a Wiki article?

    Thanks!


    Ed Price, SQL Server Customer Program Manager (Blog, Small Basic, Wiki Ninjas, Wiki)

    Answer an interesting question? Create a wiki article about it!

    Wednesday, September 25, 2013 9:50 PM
  • @Ed

    good idea - will do sometime, but working away from home for next 2 weeks.

    Thursday, September 26, 2013 8:54 PM