Visual Basic

Moderators: None (Apply to moderate this forum)
Number of threads: 17974
Number of posts: 55343

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Help me calculate percentage Posted by nmt6789 on 14 Nov 2012 at 3:52 AM
I have a homework problem where I have to calculate the winning percentage of the number of basketball games won.

I have a textbox for gamesWon, a textbox for gamesLost, a button to compute the percentage and a textbox to display the winning percentage.

This is the code that I have written so far.


Dim gamesWon As Integer
Dim gamesLost As Integer
Dim totalGames As Integer
Dim winningPercentage As Double


gamesWon = CInt(txtGamesWon.Text)
gamesLost = CInt(txtGamesLost.Text)
winningPercentage = CDbl(txtPercentage.Text)




totalGames = (gamesWon + gamesLost)

winningPercentage = (gamesWon / totalGames) * 100

I am having trouble and I am getting errors. Any help would be appreciated.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.