To take part in discussions on talkSFU, please apply for membership (SFU email id required).

COMP 110 Assignment 2....

edited May 2008 in General
Ok Im having a hell of a time figuring out Assignment 2 in CMPT 110. Text book is a useless, study guide is useless. Totally lost. Have no idea how to program in Visual Basic. Anyone done it, or can help me with it?

thanks

Comments

  • edited May 2008
    COMP?? Do you mean CMPT?

    You are having problems with Visual Basic.

    You sir, are an epic fail.
  • edited May 2008
    JayDub;30489 said:
    COMP?? Do you mean CMPT?

    You are having problems with Visual Basic.

    You sir, are an epic fail.
    lol


    what's the assignment?
  • edited May 2008
    and this sir, is why i decided to never ever take a CMPT class ever again
  • edited May 2008
    I'm very new to VB, no programming experience at all. yes it is CMPT 110

    assignment asks to make a button "abcde" and another button "next" when button "abcde" is pressed "a" is displayed in text box (read only). when "next" button is clicked the next letter "b" is displayed, then "c" and so on. I have to make another button that changes the letter case. ex. when button "case" is clicked the letter displayed in text box ("a") should change to ("A"). Another button to delete the previous letter on the screen (and im assuming display the previous letter). Another button to exit the program. -_-
    thanks!
  • edited May 2008
    forgot to mention, no "if statements" allowed. and suppose to use something called "shared" variable. and use the ASCII codes to scroll through the letters.

    dear God!
  • edited May 2008
    Ok, I haven't used VB in a long time. I don't even have it on this computer. I don't even have windows on this computer, so these functions probably don't even exist, but here's how I would do it.

    Your "abcde" button - open up the "action performed" code for it. Then, in that code, do something like
    textbox1.setText(\"a\").


    Now, the "next" button - go to its "action performed" section - the action should access the the letter in the textbox and add 1 to it because ascii letters are ordered by number, each being 1 greater than the last.
     textbox1.setText( textbox1.charAt(0) + 1 )


    For the shift button, do the same as "next" but subtract 35 instead of adding 1. The upper case letters are 35 less than their lowercase equivalents in ascii.

    edit: there, see? I can be helpful, even if it is VB. I didn't even mock the OP once.
  • edited May 2008
    Ether;30494 said:
    Ok, I haven't used VB in a long time. I don't even have it on this computer. I don't even have windows on this computer, so these functions probably don't even exist, but here's how I would do it.

    Your "abcde" button - open up the "action performed" code for it. Then, in that code, do something like
    textbox1.setText(\"a\").


    Now, the "next" button - go to its "action performed" section - the action should access the the letter in the textbox and add 1 to it because ascii letters are ordered by number, each being 1 greater than the last.
     textbox1.setText( textbox1.charAt(0) + 1 )


    For the shift button, do the same as "next" but subtract 35 instead of adding 1. The upper case letters are 35 less than their lowercase equivalents in ascii.

    edit: there, see? I can be helpful, even if it is VB. I didn't even mock the OP once.
    error : "setText is not a member of system.windows.Forms.... "
    are you sure your talking in VB terms?

    but your ascii help makes sense.
    thanks
  • edited May 2008
    No, he's talking in pseudo.

    Translate it into VB.
  • edited May 2008
    yeah, and one of those should actually be something like "textbox1.tostring().charAt(0)"

    I can't remember the exact class structure of VB's objects.
  • edited May 2008
    This is why you are in the class, to learn.

    Take your book (or use google) and look at what has been taught to you and apply it to this problem.
  • edited May 2008
    I need yo use MOD operator for the "next" button
    how do u do that?
  • edited May 2008
    I'm not sure why you'd want to..

    mod, or "%" in most languages just gives you the remainder of a division.

    ie: 3 mod 2 = 1
  • edited May 2008
    Ether;30547 said:
    I'm not sure why you'd want to..

    mod, or "%" in most languages just gives you the remainder of a division.

    ie: 3 mod 2 = 1
    prof says so.. lol
    have to use MOD 5 or something to find the displacement of the "ascii" general equation and use "chr" command to display command in textbox
    his ex. is:
    displacement = (displacement + 1) Mod 5
  • edited May 2008
    Here's how to loop through letters for a while with the mod operator.
    (I still think this is a weird thing to do.. but ooookaaay)

    Suppose you have a 5 letter cycle: A B C D E

    also, suppose that A=0, B=1 C=2 D=3 E=4

    and your counter variable X

    Set X = 0

    now, for every time the "next" button is clicked:

    increment X by one
    display the character that corresponds to X mod 5

    0 mod 5 = 0 A
    1 mod 5 = 1 B
    2 mod 5 = 2 C
    3 mod 5 = 3 D
    4 mod 5 = 4 E
    5 mod 5 = 0 A
    6 mod 5 = 1 B
    7 mod 5 = 2 C

    see how the pattern repeats itself? Anyways, that's probably what your prof wants you to do to the letters. There are some more details you'll need to work out if you're doing it with ascii because ascii values are actually like 90-120 or something like that.

    That's the general idea. Now go figure the rest out yourself.
  • edited May 2008
    lol thanks.

    I get it now and thank you for your help!

    I did set up the MOD 5 and it is recognizing it to display the thing I want, but I have one more question. I need something in the code to read each displacement line with each click of the button, what it does now, is just reads all the lines at once and displays the last character "E", how do I do this?

Leave a Comment