bradleyman88
New member
- Joined
- May 8, 2013
- Messages
- 3
- Programming Experience
- Beginner
Hey all, first time poster here, and a complete newbie at VB.net. I'm supposed to be creating a program that takes the user inputted year in which they were born, and have the program spit back out how old they are and a fact about the year/decade that the user was born in. I have the code mostly done, i'm just stuck on what to do next to get the program to work
There is the code that i have done so far, but i'm also attaching the .txt to the post if the formatting isn't correct
Module Module1 Sub Main() Dim YearofBirth As Integer Dim age As Integer System.Console.WriteLine("This program will find your age, given the year you were born.") System.Console.WriteLine("Press any key to continue.") System.Console.ReadKey() System.Console.WriteLine("Please enter the year in which you were born.") YearofBirth = Console.ReadLine() Do Until YearofBirth > 0 And YearofBirth < 2014 Loop If YearofBirth > 2013 Or YearofBirth < 0 Then System.Console.WriteLine("Number is not in range and will not be used.") System.Console.WriteLine("Please enter the year in which you were born.") YearofBirth = Console.ReadLine() Do Until age = 2012 - YearofBirth Loop elseIf age > 114 Then System.Console.WriteLine("You were born in a decade before the 1900's.") System.Console.WriteLine("You might be " & age & " years old.") System.Console.ReadKey() elseIf age > 104 Then System.Console.WriteLine("You were born in the decade beginning with 1900") System.Console.WriteLine("You are " & age & " years old.") System.Console.WriteLine("The Commonwealth of Australia was created.") System.Console.ReadKey() elseIf age > 94 Then System.Console.WriteLine("You were born in the decade beginning with 1910") System.Console.WriteLine("You are " & age & " years old.") System.Console.WriteLine("The S. S. Titanic sinks on her maiden voyage after colliding with an iceberg. 1513 drown.") System.Console.ReadKey() elseIf age > 84 Then System.Console.WriteLine("You were born in the 1920s") System.Console.WriteLine("You are " & age & " years old.") System.Console.WriteLine("Refrigerator sales reach 75,000 up from 10,000 in 1920") System.Console.ReadKey() elseIf age > 74 Then System.Console.WriteLine("You were born in the 1930's") System.Console.WriteLine("You are " & age & " years old.") System.Console.WriteLine("Scotch tape was invented by 3M engineer Richard Drew.") System.Console.ReadKey() elseIf age > 64 Then System.Console.WriteLine("You were born in the 1950's") System.Console.WriteLine("You are " & age & " years old.") System.Console.WriteLine("Les Paul started selling his classic electric guitar.") System.Console.ReadKey() elseIf age > 44 Then System.Console.WriteLine("You were born in the 1960's") System.Console.WriteLine("You are " & age & " years old.") System.Console.WriteLine("President John F. Kennedy was assassinated.") System.Console.ReadKey() elseIf age > 34 Then System.Console.WriteLine("You were born in the 1970's") System.Console.WriteLine("You are " & age & " years old.") System.Console.WriteLine("The cost of a SuperBowl ad was $125,000") System.Console.ReadKey() elseIf age > 24 Then System.Console.WriteLine("You were born in the 1980's") System.Console.WriteLine("You are " & age & " years old.") System.Console.WriteLine("Michael Jackson's Thriller album was released.") System.Console.ReadKey() elseIf age > 14 Then System.Console.WriteLine("You were born in the 1990's") System.Console.WriteLine("You are " & age & " years old.") System.Console.WriteLine("The best film Oscar winner was Unforgiven.") System.Console.ReadKey() elseIf age > 4 Then System.Console.WriteLine("You were born in the decade beginning with the year 2000") System.Console.WriteLine("You are " & age & " years old.") System.Console.WriteLine("Steve Fossett finished his non-stop trip around the world via balloon.") System.Console.ReadKey() elseIf age < 4 Then System.Console.WriteLine("You were born in the current decade!") System.Console.WriteLine("You are " & age & " years old.") System.Console.WriteLine("Barack Obama is the President.") System.Console.ReadKey() End if End Sub End Module
There is the code that i have done so far, but i'm also attaching the .txt to the post if the formatting isn't correct
Attachments
Last edited by a moderator: