Click here to Skip to main content
15,113,295 members
Articles / Programming Languages / Visual Basic
Tip/Trick
Posted 7 Sep 2010

Tagged as

Stats

8.9K views
1 bookmarked

How to complete your programming homework assignment

Rate me:
Please Sign up or sign in to vote.
1.00/5 (1 vote)
7 Sep 2010CPOL
A short program that demonstrates some fundamental programming techniques that every student should understand.
The following short program demonstrates a number of fundamental programming techniques that you will probably need when attempting to complete homework assignments.

This isn't the answer to your homework assignment, but if you don't understand this program then you won't get far.

VB.NET
Public Class Form1

    Private ableToProgram As Boolean = False

    Private Sub Button1_Click(ByVal sender As System.Object, _
                              ByVal e As System.EventArgs) _
                              Handles Button1.Click
        Dim grade As String
        Dim decision As String

        While Not ableToProgram
            decision = InputBox("Do you want to cheat? (Y/N)", _
                                "Learn to Program", "Y")
            If decision.ToUpper = "Y" Then
                grade = PostAssignmentOnForums()
            Else
                grade = DoWorkYourself()
            End If
            MsgBox(String.Format("You got an {0}", grade))
        End While

        MsgBox("Good Choice!")
    End Sub

    Function PostAssignmentOnForums() As String
        ableToProgram = False
        Return "F"
    End Function

    Function DoWorkYourself() As String
        ableToProgram = True
        Return "A"
    End Function

End Class

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

No Biography provided

Comments and Discussions

 
QuestionDoing programming homework is a tough job Pin
Dave Forney8-Apr-15 6:16
MemberDave Forney8-Apr-15 6:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.