Results 1 to 8 of 8

Thread: Its suppose to have a trivia for each decade.Help!!( its a long program)

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2012
    Posts
    2

    Its suppose to have a trivia for each decade.Help!!( its a long program)

    only one decade is working for every decade. The errors are logical so i don't know where to start correcting them:
    Code:
    'this was suppose to be project 4 for final project but a1 prints for each decade, why?
    Module Module1
        Public Delegate Sub age()
        Sub Main()
            'at first I had this on top of sub main() and it wouldn't work
            Dim zero As New age(AddressOf a0)
    
            Dim one As New age(AddressOf a1)
    
            Dim two As New age(AddressOf a2)
    
            Dim three As New age(AddressOf a3)
            Dim four As New age(AddressOf a4)
            Dim five As New age(AddressOf a5)
            Dim six As New age(AddressOf a6)
            Dim seven As New age(AddressOf a7)
            Dim eight As New age(AddressOf a8)
            Dim nine As New age(AddressOf a9)
            Dim ten As New age(AddressOf a10)
            'now i have make the decision for each age using key word if
            Console.WriteLine(" This program will tell you your age once you type your today's date and date of birth. (press any key to continue)")
            Console.ReadKey()
            Console.Clear()
            'made some grammatical changes
            Console.WriteLine(" a trivia will pop up that will ask you questions about your birth decade.")
            Console.ReadKey()
            Console.WriteLine("Here are some tips: freshen up on what you know about your decade with factmonster.com.")
            Console.WriteLine("the program is case sensitive. Remember to put your uppercases where they need to be.")
            Console.ReadKey()
            Console.Clear()
            Console.WriteLine(" Finish freshening up? Here it goes!")
            Console.ReadKey()
            Console.Clear()
            'IT WORKED ON FIRST TRY!!!
            Try
                'did something wrong here. the wrong questions popped up for the trivia
    
                Console.WriteLine(" Enter birth month: (ex:March=03)")
                Dim p As Integer = Console.ReadLine()
                Console.WriteLine("enter day: (ex: 12)")
                Dim o As Integer = Console.ReadLine()
                Console.WriteLine("enter year: (ex: 1998)")
                Dim n As Integer = Console.ReadLine()
                Console.Clear()
                Console.WriteLine(" Enter current month: (ex:March=03)")
                Dim m As Integer = Console.ReadLine()
                Console.WriteLine("enter current day: (ex: 12)")
                Dim l As Integer = Console.ReadLine()
                Console.WriteLine("enter current year: (ex: 1998)")
                Dim h As Integer = Console.ReadLine()
                Console.Clear()
                Dim z As Integer = h - n
                If p > m Then
                    If o > l Then
                        z = z - 1
                    Else
                        z = z
                    End If
                Else
                    z = z
                End If
                Console.WriteLine(" you are:")
                Console.WriteLine(z)
                Console.ReadKey()
                Console.WriteLine("Now its time for some questions:")
                Console.Clear()
                Console.WriteLine(n)
                Console.ReadKey()
                If n < 1900 Then
                    Console.WriteLine(" The program does not have a trivia for a decade this early. Sorry.")
                    Console.ReadKey()
    
                ElseIf 1900 < n < 1910 Then
                    zero()
                    'a1 worked for the worng decade, why?
                ElseIf 1909 < n < 1920 Then
                    one()
                ElseIf 1919 < n < 1930 Then
                    two()
                ElseIf 1929 < n < 1940 Then
                    three()
                ElseIf 1939 < n < 1950 Then
                    four()
                ElseIf 1949 < n < 1960 Then
                    five()
                ElseIf 1959 < n < 1970 Then
                    six()
                ElseIf 1969 < n < 1980 Then
                    seven()
                ElseIf 1979 < n < 1990 Then
                    eight()
                ElseIf 1989 < n < 2000 Then
                    nine()
                ElseIf 1999 < n < 2010 Then
                    ten()
                Else
                    Console.WriteLine("this decade is not in the system. try again.")
                    Console.ReadKey()
                End If
                Console.Clear()
                Console.WriteLine(" thank you for playing!")
                Console.ReadKey()
                Console.Clear()
                Console.WriteLine(" please rate this program:(if not just exit out)")
                Console.WriteLine("E for excellent")
                Console.WriteLine(" G for good")
                Console.WriteLine("A for average")
                Console.WriteLine("D for displeasing")
                Dim c As String = Console.ReadLine()
                Console.Clear()
                If c = ("E") Then
                    Console.WriteLine(" thanks")
                ElseIf c = ("G") Then
                    Console.WriteLine(" thanks, I'm working on it")
                ElseIf c = ("A") Then
                    Console.WriteLine("It'll be better next time!")
                ElseIf c = ("D") Then
                    Console.WriteLine(" can you explain why it was bad so I can fix it next time:(if no just press enter)")
                    Console.ReadLine()
                    Console.WriteLine(" sorry for the inconvenience. It will be improved.")
                End If
            Catch ex As Exception
                Console.Clear()
                Console.WriteLine("please try again. The program only accept integers in the date.")
            End Try
            Console.ReadKey()
            'forgot,console.readkey()
        End Sub
    ' the whole thing could fit. The error is in the main sub somewhere
    Last edited by gep13; Aug 17th, 2012 at 06:37 AM. Reason: Added code tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width