Asked by:
help please!

General discussion
-
hi
i need help with completing this code:
Method Q2b12J(input As String) As String
’Preconditions: none
’Postconditions: A string is returned that consists of all the letter
’characters from input in the same order and with the same
’multiplicity, but in lower case. For example, if input is
’"A Good Egg!", then "agoodegg" is returned.
result As String
temp As Char
Set result To ""
For i As Integer From 0 To ’Add expression here.
’Give the loop body here so that the For loop will add all the letter
’characters in input to result.
End For
’Add a line of code to convert result to lower case here.
Return result
End Methodwhat i have done so far is:
Method Q2b12J(input As string) As String
Result As string
temp As Char
Set result To “”
For i As Integer From 0 To 3 Step 1
End For
I cant finish it off, please help
Friday, January 4, 2013 11:26 AM
All replies
-
First of all, this thread was erroneously listed as "Info" when it should have been "Question."
Secondly, this looks like a homework problem, and NO ONE should be doing your homework for you!
Paul: You should probably delete the code you provided, and just put in a few hints. It's very doubtful that the poster will even understand your code. From what AlertMe posted above, he has a very long way to go, and should be starting out with something very simple. If he tries to submit the code you posted, his teacher will know he didn't do it.
For homework questions, only hints should be provided, to help explain one of the concepts the poster is having trouble with. The poster needs to work out the solution for himself, post the code that he's having trouble with, and ask for specific information to help with that part of the code. He is NOT to have someone else complete the code for him!
Solitaire
Friday, January 4, 2013 8:36 PM -
First of all, this thread was erroneously listed as "Info" when it should have been "Question."
Secondly, this looks like a homework problem, and NO ONE should be doing your homework for you!
Paul: You should probably delete the code you provided, and just put in a few hints. It's very doubtful that the poster will even understand your code. From what AlertMe posted above, he has a very long way to go, and should be starting out with something very simple. If he tries to submit the code you posted, his teacher will know he didn't do it.
For homework questions, only hints should be provided, to help explain one of the concepts the poster is having trouble with. The poster needs to work out the solution for himself, post the code that he's having trouble with, and ask for specific information to help with that part of the code. He is NOT to have someone else complete the code for him!
Solitaire
I didn't realize this was a homework question, but now that you mention it, maybe it is. I will delete my last response.
OP: It this is not homework, come back and let me know and I'll repost the answer. If this is home work and there is a specific method you need help with, please refine your question down to a less all-inclusive question, such as "How do I use a loop", or "How do I declare a variable", or "What am I doing wrong?<source>".
Thanks
If you want something you've never had, you need to do something you've never done.
Everyone should take the time to mark helpful posts and propose answers!Answer an interesting question?
Create a wiki article about it!
Friday, January 4, 2013 8:43 PMModerator -
Firstly, can you verify what version of Visual Basic .Net you are using?
Secondly, if you type the code you provided, does it show any errors? Fix as many errors as you can. Some should be pretty obvious.
Based on your requirements it looks like you need to loop through each character of the string (input) ignoring spaces, convert that character to lower case, then append it to a result string (Result), and finally, return the result string back.
Looking at the code you provided, you need to review how to declare variables properly, how to declare functions, and the proper syntax for the For Next loop.
To get you started, without giving you the answer, your function declaration should look like this:
Public Function Q2b12(input As String) As String 'Fill in the rest of the code here. End Function
Note that a Function declaration starts with the Function keyword and ends with "End Function"
Good luck!
- Edited by Chris Dunaway Monday, January 7, 2013 9:24 PM type
Monday, January 7, 2013 9:24 PM