• 0

SumNumbers in VB.NET


Question

Okay I'm having the toughest time trying to figure out how to do this program. I started but I need help finishing it, figuring out what else I need.

 

The Prompt is:

Create a SumNumbers application that calculates the sum of a range of numbers entered by the user and displays in a label an expression with the numbers in the range.

 

For example, if my starting number is 26 and my ending number is 30, then in the lblMessage box it will display 26+27+28+29+30 = 140,

 

Also I have to use an If... Then.. Else structure within a For Next Loop. And she gives us an Hint:(Use the &= counter operator in this program.

HELP ME PLEASEEE!!!!!!  

 

THERE'S A PICTURE OF THE PROMPT ATTACH, USE IF YOU DON'T UNDERSTAND WHAT I WAS TRYING TO SAY(lol)

post-514517-0-27126800-1391634385.png

Link to comment
Share on other sites

23 answers to this question

Recommended Posts

  • 0

This looks like homework. We're not here to do your homework for you.

Perhaps pay attn in class and read the material.

 

Specially since this is a really really really easy one ...

  • Like 1
Link to comment
Share on other sites

  • 0

After speaking with the OP I have unlocked this thread. They are not looking for a complete answer and are just having problems getting the number range to appear at the bottom as in the example.

  • Like 1
Link to comment
Share on other sites

  • 0

Hello,

You just completely defeated the point of the homework, congratulations.

I disagree: Learning from one example can benefit in the long run. Once he understand this excerise, maybe the next one wont be so difficult.

Of course, if he asks 2 or 3 more problems, we cant do them all!

Link to comment
Share on other sites

  • 0

Hello,

I disagree: Learning from one example can benefit in the long run. Once he understand this excerise, maybe the next one wont be so difficult.

Of course, if he asks 2 or 3 more problems, we cant do them all!

But now he doesn't have to learn, he can just copy-paste and hand it in. The point of the homework is figuring something out by yourself. Don't provide complete working solutions to vague requests for help.

  • Like 4
Link to comment
Share on other sites

  • 0

Hello,

But now he doesn't have to learn, he can just copy-paste and hand it in. The point of the homework is figuring something out by yourself. Don't provide complete working solutions to vague requests for help.

Homework is a dumb concept. Pick any subject you did in class that you didnt like and you dont dedicate to now and see how that has helped you.

If you wanna learn, we can look it up ourselves. Half of the things we have learned in live we have had to look it up.

I know my work had NOTHING to do with ANYTHING I did at school. I just got here, buscted my ass, and learned it because I wanted to and I wanted to get paid.

I dont agree personally with the homework but I wont do everything he asks just to pass. For one time its done I dont think we are going to ruin his studing processes (if he really wants to program)

 

Also at the end of the day, if its been asked, its probably been programmed already. So he would have found a answer, copy/pasted it anyways...

 

If he wants to get started, I gave him a great example. If he doesnt, hey, his lost but dont expect another answer for me/us.

Link to comment
Share on other sites

  • 0

Hello,

Homework is a dumb concept. Pick any subject you did in class that you didnt like and you dont dedicate to now and see how that has helped you.

If you wanna learn, we can look it up ourselves. Half of the things we have learned in live we have had to look it up.

I know my work had NOTHING to do with ANYTHING I did at school. I just got here, buscted my ass, and learned it because I wanted to and I wanted to get paid.

I dont agree personally with the homework but I wont do everything he asks just to pass. For one time its done I dont think we are going to ruin his studing processes (if he really wants to program)

 

Also at the end of the day, if its been asked, its probably been programmed already. So he would have found a answer, copy/pasted it anyways...

 

If he wants to get started, I gave him a great example. If he doesnt, hey, his lost but dont expect another answer for me/us.

That sounds good, but the reality is you can't be a good programmer without understanding basic problem solving. He came here because he obviously couldn't easily Google the answer otherwise why wait hours for a forum reply?

 

He came here for the quick drop. Copy paste his homework in and someone else will do all the work. You gave him that victory...

 

If you truly want to help you have to enable him to be a better problem solver and not to seek quick solutions without understanding what they are doing.

  • Like 1
Link to comment
Share on other sites

  • 0

But now he doesn't have to learn, he can just copy-paste and hand it in. The point of the homework is figuring something out by yourself. Don't provide complete working solutions to vague requests for help.

I'd just like to point out that the OP had figured out eight of those questions on his own, so it's no big deal if he gets help with one question? :)

Link to comment
Share on other sites

  • 0

I'd just like to point out that the OP had figured out eight of those questions on his own, so it's no big deal if he gets help with one question? :)

I'm not opposing providing him with help; I'm saying that providing something that he can just hand in is not help.

Link to comment
Share on other sites

  • 0

I'm not opposing providing him with help; I'm saying that providing something that he can just hand in is not help.

OK, but he'll probably still have to study the code to figure out how it works as teachers tend to want you to explain how you got your answer. Also, the code is not one hundred complete as it's missing the textbox, button and label controls, which he'll have to code in manually.

Link to comment
Share on other sites

  • 0

Sorry but I'm going to step in and hide the post containing the full solution.

 

Sure, homework is useless since everyone ends up with more or less the same solution. That's not the point though - you need to learn how to get there somehow. Posting small code snipplets of how you would implement a difficult algorithm is fine if that's only a small part of the solution. Posting the entire solution is a no-no. Plus, if the OP is in post-secondary studies there are academic policies that we don't want the OP to run afoul of.

  • Like 3
Link to comment
Share on other sites

  • 0

Hello,

Sorry but I'm going to step in and hide the post containing the full solution.

 

Sure, homework is useless since everyone ends up with more or less the same solution. That's not the point though - you need to learn how to get there somehow. Posting small code snipplets of how you would implement a difficult algorithm is fine if that's only a small part of the solution. Posting the entire solution is a no-no. Plus, if the OP is in post-secondary studies there are academic policies that we don't want the OP to run afoul of.

Congrads; You just helped another student not become curious about programming and problably just wont do the homework because he feels its a chore rather than a learning process using a example.

Ill restate what I put: Learning from a example is BETTER than actually working it out. But ONE example: I did not plan to put 200000 resolutions to any future homework problems he put. Just one. If he wants to learn further, THEN we can ask him questions like Andre did, which is perfectly fine and normal.

Maybe his next problem is: Input in a text box your name, hit a button, print it in a label.

I would have explained:

You see that I used in the sumnumbers example label3.text right? And equaled that to something: That means that Im modified the label's text. Maybe the textbox also has a textbox.text that you can GET to PUT in the label3.text...

Link to comment
Share on other sites

  • 0

Hello,

Congrads; You just helped another student not become curious about programming and problably just wont do the homework because he feels its a chore rather than a learning process using a example.

Ill restate what I put: Learning from a example is BETTER than actually working it out. But ONE example: I did not plan to put 200000 resolutions to any future homework problems he put. Just one. If he wants to learn further, THEN we can ask him questions like Andre did, which is perfectly fine and normal.

Maybe his next problem is: Input in a text box your name, hit a button, print it in a label.

I would have explained:

You see that I used in the sumnumbers example label3.text right? And equaled that to something: That means that Im modified the label's text. Maybe the textbox also has a textbox.text that you can GET to PUT in the label3.text...

The problem is.. you can't post the answer.. because he still isn't thinking.

Yes, learning from example is good.. but you need to understand WHAT the code is doing, you need to understand WHY you are doing what you are doing.  I learn by example a lot, and I look up code.. but I don't use it unless I understand it.  

 

I could say..

 

GLfloat vertices[] = { 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.1f, 1.1f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,};

glVertexPointer(2,GL_FLOAT,16,vertices);
glTexCoordPointer(2,GL_FLOAT,16,vertices+2);

And say.. there you go! Have fun.  But you have no clue how that code works, or what it does.  But then you ask: "Now I need to use a normals coordinate too" And I respond with "Well do the same as done for the vertex coord, but add your normals in".   That does you nothing as you didn't understand the code in the first place but used it anyway.

Link to comment
Share on other sites

  • 0

It is really simple. I think it would help the most by re-explaining the problem, in English, using words related to coding. That way you get help, while you're also required to code it, allowing the opportunity to learn. Here goes:

 

Original problem:

Create a SumNumbers application that calculates the sum of a range of numbers entered by the user and displays in a label an expression with the numbers in the range.

Restrictions:

Use an If... Then.. Else structure within a For Next Loop. Use the &= counter operator in this program.

 

Translation:

Name of application: SumNumbers

Operation of application: Sum integers, and show the integers summed as well as the result, all in a text label

Inputs: MinInput (Integer), MaxInput (Integer)

Outputs: SumText (String)

 

The approach (in pseudocode):

- Get your inputs

- For every integer value starting from MinInput to MaxInput:

---- Append a string version of the integer value to SumText, a string variable that we're building

---- If it's not the final value, append a "+" to SumText

---- Add the integer version of the integer value to an integer variable that's holding our total

- Now that we have the total, append "=" to SumText, and append a string version of the total to SumText

- SumText has the answer, which is a string showing which integers were summed and what the total was. Show SumText.

 

Does that help you hopefully? That is the logic you need, and should have been able to determine on your own. The rest of the job is to put it into code. You can use &= (which means "set it equal to itself plus something else")... in each of the 3 steps within the For-loop above.

 

Good luck!

Jacob

Link to comment
Share on other sites

  • 0

Hello,

The problem is.. you can't post the answer.. because he still isn't thinking.

Yes, learning from example is good.. but you need to understand WHAT the code is doing, you need to understand WHY you are doing what you are doing.  I learn by example a lot, and I look up code.. but I don't use it unless I understand it.  

 

I could say..

GLfloat vertices[] = { 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.1f, 1.1f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,};

glVertexPointer(2,GL_FLOAT,16,vertices);
glTexCoordPointer(2,GL_FLOAT,16,vertices+2);
And say.. there you go! Have fun.  But you have no clue how that code works, or what it does.  But then you ask: "Now I need to use a normals coordinate too" And I respond with "Well do the same as done for the vertex coord, but add your normals in".   That does you nothing as you didn't understand the code in the first place but used it anyway.
Great example :)

OK, I copy/paste the code and it works but like you said I have no idea what it does but it works. I ask you that I want to add normal coordinates too. You example that I have to do the same but add normals. I ask you but what are vertex (Im really summing up here because Im not a morning person typer :p ) Then you can explain the code YOU put and I can say "Ah, because in the previous code it did this and that. Now I get it" and I would add the second answer I had to my question by my self :)

I don't know: I understand people trying to make someone think over than doing their work but you gotta start somewhere with a answer :) There is a high possibility that more problems with arise and with a previous answer, you can work it out yourself :)

I believe its just two ways of thinking of showing someone how to learn. I once had to help someone that knew NOTHING about programming and I used this way. After giving 2-3 answers, he simply did it on his own and just asked me to correct it, which most of the times were OK.

Link to comment
Share on other sites

  • 0

Hello,

Great example :)

OK, I copy/paste the code and it works but like you said I have no idea what it does but it works. I ask you that I want to add normal coordinates too. You example that I have to do the same but add normals. I ask you but what are vertex (Im really summing up here because Im not a morning person typer :p ) Then you can explain the code YOU put and I can say "Ah, because in the previous code it did this and that. Now I get it" and I would add the second answer I had to my question by my self :)

I don't know: I understand people trying to make someone think over than doing their work but you gotta start somewhere with a answer :) There is a high possibility that more problems with arise and with a previous answer, you can work it out yourself :)

I believe its just two ways of thinking of showing someone how to learn. I once had to help someone that knew NOTHING about programming and I used this way. After giving 2-3 answers, he simply did it on his own and just asked me to correct it, which most of the times were OK.

 

The problem is.. how do you know they are going to ask for an explaination and not just copy paste and call it good.  When a problem arises just go somewhere else to get a copy and paste answer. I guess when it comes to programming I am just very pessimistic.  I work with someone who has a background with electrical engineering and low level programming.  He was tasked with writing a very simple high-level program and he struggled with it.  Both I and the other programmer tried to help, but in the end it was more or less mine and the other programmers code re-written by him.  He is very talented and knows what to do with embedded programming, but he doesn't grasp the concepts.  

As a programmer, it makes it hard when I have to explain how code works to another programmer.. as I have the mentality that you need to know how code works and not just what the solution is.  Providing a solution does not encourage the research and learning.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.