Sunday, May 15, 2011

Word Count Projector

Recently, I reinstalled Visual Basic 2008 to make a neat little program. I was curious how much I had to write each day to write a novel length book in a year's time. From there, I was curious how much time would be saved if I wrote more than the minimum required word count for the day. It comes out to being just under 137 words which is less than the average word count for a page (250) per day. So here is what the program looks like and the code I wrote.


        Dim ct1 As Integer
        Dim ct2 As Double
        Dim wordCt As Integer
        Dim daysWorked As Integer
        Dim avgWordCtPerDay As Double
        Dim extra As Double
        Dim temp As Integer
        Const AVG_WORD_COUNT As Double = (50000 / 365)


        wordCt = Integer.Parse(Me.txtDailyWordCount.Text)
        daysWorked = Integer.Parse(Me.txtDaysWorked.Text)
        avgWordCtPerDay = wordCt / daysWorked
        extra = avgWordCtPerDay / AVG_WORD_COUNT
        While ct2 < 365
            ct1 = ct1 + 1
            ct2 = ct2 + extra
        End While
        Me.lstResults.Items.Add("Days Total: " + temp.ToString(ct1))
        Me.lstResults.Items.Add("Days Saved: " + temp.ToString(365 - ct1))
        Me.lstResults.Items.Add("Days Left: " + temp.ToString(ct1 - daysWorked))
As for the Clear button...

        Me.lstResults.Items.Clear()
And this is the GUI

As long as I remember how many days I have been at a particular novel, I can gauge if I am falling behind or speeding up on each day's writing count. It is nice to know that after almost three years of not programming, I still got it.

No comments:

Post a Comment