Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2010 Comparing values

$
0
0
Hello to you all fellow programmers ;)

I'm working on a program for the local boyscouts. Some sort of beer stock exchange.

Let's say we've got 5 type of drinks. The bartender presses one of the 5 button that will increment one of the drinks.
After a 5 minute periode has passed, I calculate how much each drink has contributed in percentages.
The top 2 drinks raise in price
middle stays the same
the lowest 2 drop in price
Code:

dim aCola, aSprite, aFanta, aIcetea, aColaLight as integer
dim pCola, pSprite, pFanta, pIcetea, pColaLight as double
dim priceCola, priceSprite, priceFanta, priceIcetea, priceColaLight as double
dim total as integer

'calculate total
total = aCola, aSprite, aFanta, aIcetea, aColaLight

'Calculate share of total in percents
pCola = aCola / total * 100
pSprite = aSprite / total * 100
pFanta = aFanta / total * 100
pIcetea = aIcetea / total * 100
pColaLight  = pColaLight / total * 100

'The 2 drinks that have the most consumptions need to increment with 0.30 cents
'The middle drink has to stay the same price
'The 2 lowest consumed drinks have to drop with 0.30 cents

'I've got no idea how to do this.




Hope someone can help me !
Thanks in advance.

Matthijs

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>