Visual Basic Help... Again

Hey guys, I got a little help last time, and I thought I could do it, but I can't.

 

My course ends really soon, and my parents are about to kill me because I have a low grade in my VB.Net class. The class is go at your own rate, so you just need to finish the assignments they give you. I have tried for hours on this 100 point project, and cannot for the life of me get any results. 

 

Please write and 2 out of the 4 options I give you. If you write them and they work, I'd be happy to send a few dollars your way via paypal, or maybe buy you a game on Steam. Thanks again.

 

Option 1Write a program to find the average grade given 15 user-inputted scores on tests. The program should also provide the following feedback according to the final score (i.e. A, B, C, D, F).

Option 2Write a program that would resemble a checkbook register that will ask for input, both deposits and debits, and keep a running total in that person’s bank account. That total would be given upon request of the user.

Option 3Write a program to run two separate threads printing numbers (or words) in ascending and descending orders. The numbers (or words) should be given by the user.

Option 4Write a program that has a function to give someone their age if they input their date of birth. Along with their age, the user should receive some trivia about the decade they were born.

 

None of these tasks are hard, you need to do them yourselves or you are not going to learn. If you fail, grow a pair of balls and take the heat because its obviously your fault, but realise that you can always try again. Hopefully nobody on here is going to give you the answers. 

unbelievable, some places still teach vb? sux to be you

like the bacondrinker said of course, try harder.. if you put "vb find age from dob" into google you'll probably get exactly what you need anyway

"unbelievable, some places still teach vb? sux to be you"

And.. why? VB.net is still very much used and some companies will expect some experience with it in order to work with and modify programs that work with their databases. Not all companies use out of box software to handle data.

Taco,

Have you gone through the lesson yourself and done any of the samples throughout the lesson? Trust me, baby stepping and doing the lesson as it is meant to be done will be beneficial.

Food for thought:

When going to school for anything in the Tech industry you must learn how to learn. Schooling only gets you in the door, after that it is up to you to keep up to date and everything changes so fast it will make your head spin if you don't know how to teach yourself. It's boring, I know but, referrences and manuals are your best friend.

TacoBell - I'll make the programs for these and post them, but I highly recommend that you learn how to do these yourself... I'll post them as soon as I get home (I'm on my phone right now)

 

VB.NET and C# Code fo Tasks 1 and 3

 http://pastie.org/pastes/5731874/text 

Taco, it is nice of Arkane to have done this for you. Once you have used his code and passed, I want you to try it again without looking at his code. If you have to look at it again, start all over again. I want you to do this until you understand completely how his code works.

Thanks Arkane.

Thank you so much. I still have to write a report for the program and creat flowcharts etc. So I will be breaking down this code. I seriously cannot thank you enough, I really needed this. 

I will most definitely be going back through and trying to re-create this code. I have to write a report on the code that Arkane was nice enough to write for me, so I'll have a pretty good idea of what to do when I'm done. I know how the code works, and have a pretty good understanding of that, but I just don't know how to properly use the codes. Hopefully I will be able to recreate this on my own very soon. I will continue to try to learn as much VB as possible even after the course is done.

here's a big code snippet I made that should put you on the right track for option 4:

Module Module1

Sub Main()

Console.WriteLine("Input the year you were born.")

Dim input As Integer = Console.ReadLine()

Dim userAge As Integer = DateTime.Today.Year - input

Console.WriteLine("Your age is: " & userAge)

Console.WriteLine("The Fact for the decade of your birth is: " & decadeFact(userAge))

End Sub

Function decadeFact(ByVal userAge As Integer) As String

'Since very few people live past 80 years old, you only have to cover 9 decades.

Dim resDecFct As String

Dim lstDecFct As List(Of String) = New List(Of String)

lstDecFct.Add("fact for 1 decade ago.")

lstDecFct.Add("fact for 2 decade ago.")

lstDecFct.Add("fact for 3 decade ago.")

lstDecFct.Add("fact for 4 decade ago.")

lstDecFct.Add("fact for 5 decade ago.")

lstDecFct.Add("fact for 6 decade ago.")

lstDecFct.Add("fact for 7 decade ago.")

lstDecFct.Add("fact for 8 decade ago.")

lstDecFct.Add("fact for 9 decade ago.")

Dim decDec As Integer = userAge / 10

If decDec < 2 Then

resDecFct = lstDecFct(0)

ElseIf decDec < 3 Then

resDecFct = lstDecFct(1)

ElseIf decDec < 4 Then

resDecFct = lstDecFct(2)

ElseIf decDec < 5 Then

resDecFct = lstDecFct(3)

ElseIf decDec < 6 Then

resDecFct = lstDecFct(4)

ElseIf decDec < 7 Then

resDecFct = lstDecFct(5)

ElseIf decDec < 8 Then

resDecFct = lstDecFct(6)

ElseIf decDec < 9 Then

resDecFct = lstDecFct(7)

Else
resDecFct = lstDecFct(8)

End If

Return resDecFct

End Function

End Module

 

you need to select "console application" when starting a new project in visual studio, I assume you are doing this in visual studio, and I assume your teachers are expecting you to do a console application, and nothing too far advanced, I tried to keep it simple. Being forced by your parrents to get high grades makes this sort of subject not so fun, but I encourage you to continue on this course and learn how to program, do not EVER think you are not good enough, because you are. It takes time to gain the mindset required to program.

Yes, I know how to use console applications, and I know they are probably the easisest. Even though Arkane was nice enough to supply me with 2 complete programs, I will use what you gave me and try to make sense of it. The way the course I am taking is set up makes things very complicated, and it often leaves out important pieces of information, while leaving in completely worthless and useless information. I know I shouldn't blame it all on the course, but it sure didn't make it easy on me. Thank you so much for your help and encouragement.

I included a function in this, I assume you do not know how functions work since it also took me a very long time. A function can take on any value you tell it to. It physically becomes a value just like doing something like Dim thisName As String. You make a function Function thisName() As String, then you do some code and do a Return aStringObject. 

I also assume that you dont know about ByVal and ByRef, ByVal takes the VALUE of the input, and ByRef takes in the actual OBJECT, so if you do ByVal of integer1 = 4, the VALUE of that is 4. With ByRef, you will physically be taking integer1, and if you change it's value to 5, it completely changes the value.

oh and remember you can make a stop in the code by hitting F9, then you can step through it by hitting F11 in visual studio, this makes tracking values and debugging so much easier. 

check out http://www.dotnetperls.com and http://stackoverflow.com

both these sites have helped me a thousand times

edit:

Btw, double check my code for any math errors, I wrote it very quickly.

if you know Python, Ruby, C#, or Boo you can download the SharpDevelop IDE and it'll translate the code to VB.NET for you. That's what I did for my code snippets (I haven't done VB in a long time). The only issue is that the converter seems to have some problems and won't always generate perfect code for you. You'll need to know some VB to go back and fix the compiling errors. Anyway, feel free to use my code and good luck on your class

Wow, I had to create a betting game with multiple users and other stuff... Including passwords and stuff

Ah, that explains why your code seemed to be so complex. lol

Taco, If you have any questions, let us know, no question is a dumb question. There is no need to struggle trying to figure things out, programming should become something you enjoy.

Taco,

Any progress on making heads or tails on what Trillobite has given you?

How's the progress? I am checking this thread every day.

I am making progress! I haven't put my full attention on this program yet, as I had a few other programs to get done. 

I am at school now, and it is exam week, so I am in the library rather than the room where I work on VB. (Studying for my Chemistry Exam which is in an hour or so) When I get home, I'll work on option 4 a little bit more, and show you guys. Thanks for the help.

Taco i recommend this site as it give valuable basics on programming in many languages. I didn't have the benefit of going to school for training on VB i learn it myself by diving into it and GOOGLE there are plenty of examples out there just look for them 

http://www.homeandlearn.co.uk/

some sample code written by me 

https://github.com/dexslab/LG-Root

And just remember no schooling for it you have to have the paitence and will to code if you don't i suggest a new line of work