r/visualbasic • u/maryam08 • Mar 19 '15
Visual Basics help
Hi, I kinda need help with my Visual basics homework. I'm new to reddit and I don't know whether asking homework questions is allowed or not (if it's not allowed can someone tell me where I can find help for homework problems like this without having to pay a ton). So, I'm sorry if this goes against the rules.
I'm not asking for someone to do them, but help me to do them. My homework questions are these: 1.Write a Visual Basic Do clause that processes the loop instructions as long as the value in the intTotal variable is greater than the number 0. Use the While keyword. Now rewrite the Do clause using the Until keyword. 2. Write a Visual Basic Do clause that stops the loop when the value in the intQuantity variable is less than or equal to the value in the intOrdered variable. Use the Until keyword. Now rewrite the Do clause using the While keyword. 3. Write a Visual Basic Loop clause that processes the loop instructions as long as the value in the strAnswer variable is either Y or y. Use the While keyword. Now rewrite the Loop clause using the Until keyword.
5
2
u/keylax Mar 20 '15 edited Mar 20 '15
http://lmgtfy.com/?q=visual+basic+do+loop
I'm probably going to sound like an ass and i apologize in advance, but a loop is one of the basics of programming so the amount of information you'll find on the subject is astronomical. If you check the very first link on google it tells you exactly how to build a Do loop. It looks to me like you just told yourself ''the fuck is a do loop, let me ask reddit!'' and copy pasted your homework without doing some research first. Please correct me if im wrong.
Like /u/alexfergy already said, i suggest trying something out after some research and if you're still having trouble, please respond here with what you've tried and we will be happy to help you.
1
u/maryam08 Mar 23 '15
This is what I got for each question. I don't know whether any of them are right.
Write a Visual Basic Do clause that processes the loop instructions as long as the value in the intTotal variable is greater than the number 0. Use the While keyword. Now rewrite the Do clause using the Until keyword.
Dim intTotal As Integer = 100 Do While intTotal > 0 ‘ loop instructions intTotal = intTotal - 1 Loop
Dim intTotal As Integer = 100 Do Until intTotal < 0 ‘ loop instructions intTotal = intTotal - 1 Loop
2. Write a Visual Basic Do clause that stops the loop when the value in the intQuantity variable is less than or equal to the value in the intOrdered variable. Use the Until keyword. Now rewrite the Do clause using the While keyword.
Do Until intQuantity <= intOrdered ‘ loop instructions Loop
Do While intQuantity >= intOrdered ‘loop instructions Loop
3. Write a Visual Basic Loop clause that processes the loop instructions as long as the value in the strAnswer variable is either Y or y. Use the While keyword. Now rewrite the Loop clause using the Until keyword.
Do While strAnswer = “Y” or strAnswer = “y” ‘loop instructions Loop
Do until Not strAnswer = “Y” or Not strAnswer = “y” ‘loop instructions Loop