Use A Function To Calculate The Average Of Those Numbers?

Apr 28, 2011

I'm trying to write a program that allows the user to enter 10 numbers into an input box and then the program will use a function to calculate the average of those numbers. I'm really illiterate when it comes to Visual Basic.

View 2 Replies


ADVERTISEMENT

Call A Function To Calculate The Average Grade For The Class?

Apr 4, 2012

Write a program that reads in a set of grades for a class.The program takes in the number of students in the class from the user. When the Get Grades button is clicked the program then reads in a grade (0-100) for each student using an inputbox. The program should then display the percentage of students who pass and the percentage of students who fail.The program should call a function to calculate the average grade for the class. Then finally the result is then displayed.

Public Function GetPassRate(ByVal intGrade As Integer) As String
Do Until gradeCounter >= NumericUpDown1.Text
If intGrade >= 40 Then[code].......

View 7 Replies

Project - Average Numbers, Maximum And Minimum Values, Range Of The Numbers

Apr 7, 2009

Im trying to write a program that will do:

1.The average of the four numbers. This answer will be placed into a text box reserved for that value. This text box cannot be changed by the user.

2.The maximum and minimum values. These will be denoted by changing the color of the largest number green and the smallest number red.

3.The range of the numbers. The range is defined as the difference between the largest and smallest numbers. The range will be placed into its own text box, labeled as such. This text box cannot be changed by the user."

Im using visual studio 2008 and it has to be written in VB

View 35 Replies

Way To Calculate Average

Oct 11, 2009

Heres my [code]...

For example if I enter in 45, 45 and 89; I should get 55.75. But instead all I get is 55. How do I get the percentage?

View 2 Replies

How To Calculate Average Of Values

Jul 21, 2009

I have text1=a, text2=b, text3=c, text4=d, text5=e
Now I want to calculate the average of the values,

Here's a simple way
average=(a+b+c+d+e)/5
But what if i have values only in 3 textboxes, that means the code will still divide the sum of the values into 5, that will not be correct!

View 8 Replies

If Statement To Calculate The Average ?

Jun 7, 2012

My objective: to check the remaining btns in play and obtain the cash prizes in the remaining btns then calculate the average. It may seem simple but it actually isn't.

Here is what i have so far:

Private Sub btncase1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncase1.Click
If usercase = 0 Then
usercase = btncase1.Text

[CODE]...

View 11 Replies

Calculate Average Dependent On Criteria?

Oct 10, 2011

I have a spreadsheet that has two columns (A and B) - Column A contains Month/Year and column B contains sales. I would like a bit of vba that will look in column A to find the month/year then calculate from column B the average sales for that period. So for example:

Date Sales
Jan 11 500.00
Jan 11 250.00
Mar 11 152.00
Apr 11 116.00

So in other words there can be a number of lines with the same date/year and the code will need to identify these and average all sales from column B associated with that particular date. I would like the output to appear in a summary table showing the total average sales for each particular month - perhaps this could be output to a new sheet?

View 1 Replies

Calculate The Average From Text Files

May 19, 2011

I'm in a bit of a pickle. I'm new to Visual Basic and I have been writing a simple program to rate movies. I'm stuck on calculating the average from the text file. The text file holds the numbers from 1 - 10 (ratings). I want my program button to add all the values from the text file and display the average from the total amount of ratings and display them into a text box.

[Code]...

View 11 Replies

Exercise On Sub Procedure To Calculate The Average?

Jun 22, 2010

Write a program to calculate the average of three exam marks. The input and output should be done by subprograms GetMarks and DisplayAverage respectively. the calculation should be done by a function, CalcAverage. This is my code:

Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
Dim student As String, exam1 As Integer, exam2 As Integer, exam3 As Integer
Dim average As Double
lstResult.Items.Clear()

[code]....

View 2 Replies

Calculate An Average From A Input Integer Within A Loop?

Feb 11, 2009

I'm looking for a way to calculate an average from a input integer within a loop. When the user enters something like -90, the average will be calculated using the previously input numbers.

View 4 Replies

Calculate Average Of Excel Table Using Program?

Jun 8, 2011

I want to calculate the average value of excel table readings 1 hr once... how do i import the sheet and how do i calculate the avg in vb.net?

View 4 Replies

Piecework Form - Calculate Pay Rate And Average

Oct 20, 2009

This is the current incarnation of what I have:
'Program: Ch4E4.6
'Programmer: Jeff Pannell
'Date: October 1, 2009
'Description: This will allow for entry of a worker's name and the number of pieces completed. The program will then calculate a pay rate, but also determine an average and summarize number of pieces made, total pay and an average pay per person.

Public Class PieceworkForm
'Declaration of modular-level constants.
Const PIECE_RATEA_Decimal As Decimal = 0.5D
Const PIECE_RATEB_Decimal As Decimal = 0.55D
Const PIECE_RATEC_Decimal As Decimal = 0.6D
[Code] .....

So, my problem is that whenever the form is executed..a user would type in a worker name, and the amount of pieces made. I get a dollar amount earned and then a total pay, though they seem to be the same. More than likely I've got some sort of bad logic in there mathematically.

View 3 Replies

Program To Calculate The Total And Average Rainfall?

Feb 14, 2010

For my programm I was told to do a programm to calculate the total and average rainfall. I have done so, but now I am supposed to use two function procedures to calculate the total and average rainfall. I can not seem to figure it out and it is very frustrating.

[Code]...

View 5 Replies

Calculate Average Values From Text File Using Streamreader?

Mar 25, 2009

I'm trying to calculate an average no from data imported from a text file using streamreader. I'm not sure how the loop should read, and the result (average) I want to hold in a separate variable for future use.[code]...

View 1 Replies

Calculate The Predominant Or Average Colour In An Image File?

Jun 16, 2010

i am trying to code a program in vb.net that will calculate the predominant or average colour in an image file and then change the fillcolor of a rectangle to that predominant colour. I want to do that by getting the RGB value of each pixel, adding them up and then dividing them by the total number of pixels in the picture. This is the code that I wrote to do that.

[Code]...

I am a beginner programmer so this is basically the second time I fired up VS (not much experience). I searched the internet for the last hour but found nothing that might help me. I made sure every value is positive and changed all numerical variables from integer to decimal and I still get the error.I have absolutely no idea why this doesnt work but if I remove the "for" loop then the line written in bold works just fine.BTW this is my first post so scuze any mystakes I probably made.

View 9 Replies

VS 2008 Calculate An Average Value From Data Imported Using Streamreader

Mar 25, 2009

I'm trying to calculate the average hours worked from a set of data imported from a text file using streamreader. My problem is counting the number of entries and the total hours worked imported from a text file within a loop[.

[Code]...

View 2 Replies

VS 2010 Calculate Average Of Double Inside An Array?

Aug 18, 2011

I'm working with an API, for this I'm using this particular call: [URL]

If i use this, I will get all the .price values:

For i = 0 To .bets.Length - 1
With .bets(i)
Print(.price)
End With
Next

Can I calc the average .price value? I will need to sum all the values as well.

View 8 Replies

Make A Program That Will Calculate Sum Of Consecutive Numbers Between Two Given Numbers

Jun 4, 2012

I'm trying to make a program that will calculate the sum of consecutive numbers between two given numbers. [code]

View 13 Replies

Program A Form To Calculate Rainfall Total,average,maximum, And Minimum?

Mar 15, 2010

Im trying to programme a form to calculate rainfall total,average,maximum, and minimum.how do I create the input box that opens to input the info I cant seem to find it in the tool box. Am i Missing something, and how do I set a array to calculate?

View 2 Replies

Calculation Function - Takes The Average (which Is Calculated By A Different Function)

May 24, 2011

To have a function that takes the average (which is calculated by a different function) say for example the average is 6, now the function is to take the number 6 and get the variance from six to another number lets say its 12 so this will return a calculation of 50% variance. now here comes the issue, i have it calculating the variance how ever lets say that there is a score that is 0, how can i make it calculate the variance without taking count for that 0? i guess you can say i need it to "skip" if its a 0.

View 5 Replies

Average Of Numbers In A List Box?

Feb 16, 2012

I am working on a project where i need to get the average of 6 numbers i enter in a ListBox. There is one ListBox, one button to get the average, and one label where the average is displayed. i need to use an array and I am using the Visual Basics Programming but i dont think it is that big of a difference.

View 5 Replies

Having To Average Three Numbers Setting Up?

Jul 12, 2009

I am having to average three numbers setting this up I need to use sub procedures. I cannot figure out what I am missing.

Public Class Main
Private Sub btnAverage_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAverage.Click
Dim num1, num2, num3 As Double
Dim average As Double

[code]....

View 3 Replies

How To Average Greatest 3 Out Of 5 Numbers

Sep 26, 2009

I have a project and I need to record long jumps. I have 5 numbers but how do I average the greatest 3 of 5, I know how to average all 5. Also am I supposed to put Val for strings or not because only 0 shows up for when I put something in name but if I put a number it will show up a number

[Code]...

View 5 Replies

Finding Average Of 2 Largest Numbers?

Feb 21, 2009

I am supposed to create a program that inputs 3 numbers, takes the two largest and outputs an average of those two numbers using simple ifelse statements and logical operators only. I can't seem to get it. I've messed around for a few hours now and nothing seems to be working.

Here's what I have:

Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click
Dim score1 As Double

[Code].....

View 8 Replies

Finding Average Of Numbers In A List Box's?

May 4, 2010

Need to calculate Average Plan Duration for the 3 Shipment TypesSo far i haveQuote:

'CALCULATING AVERAGE DURATION FOR STANDARD
Dim iAverage As Integer
Dim iAvgDuration As Integer

[code]....

I uses the information from the list boxes, (lbShipmentDuration) and (lbShipmentMethod) to calcualte the average Duration for each Shipment Type.

View 19 Replies

Finding The Average Of A Set Of Numbers In A Listbox In VB?

Jun 20, 2012

I enter numbers and Names into a text box and click 'add to list'. THe names go into a seperate listbox to the numbers.I then press 'show me the list' and i get to view my numbers and names listed in the two listboxs. I also have a button which averages the numbers in the numbers list box. But i dont know how to get it to work I will divide by the number of items in the list box.note: The average will be displayed in a label called: lblavg

Here is a picture of my code: http:puu.sh/CsED
I have tried:
For each item In lstListAges.Selecteditems

[code]....

View 6 Replies

Calculating The Modal Average Of An Array Of Numbers

Nov 6, 2010

OK, so I've been given an assignment due for Monday, which was to create a console program which allows the user to enter an unknown quantity of numbers, then have the Mean, Median and Mode averages displayed of said group of numbers.

So far I've managed to get the Mean and Median to work, for both odd and even quantities of variables. I am however stuck on getting it to calculate the modal average! I don't really know how to approach this, would a structure with two fields, variable and quantity of variable, work?

Below is the code, I haven't made it display discrete of continuous data yet, I'm leaving that for the end.

Module Module1
Sub Main()
Start:
'Declare Variables

[Code].....

I imagine this is quite elementary for most of you, I unfortunately received no replies what-so-ever to my last thread...

PS: Why isn't there an option for UK in the two letter country codes?

View 5 Replies

Working On A Windows Forms App That Will Average A Set Of Numbers?

Jun 13, 2011

I'm working on a Windows forms app that will average a set of numbers, the only catch is that there are 10 textboxes(4 in the example for times sake), and not all of the textboxes could be filled with a number...I know that if i had a given set of numbers:

Dim a, b, c, d As Integer
a = t1.Text
b = t2.Text
c = t3.Text

[code].....

View 2 Replies

Series Of Numbers (separated By A Comma) And Find Average

Mar 11, 2010

I am new to VB and need to make a program that does the following:Write a VB.Net program that allows users to enter a series of numbers(separated by a comma) in a text box called series. When the users clicks the command button called Average, the program extracts the number one by one from the series and calculates the average, and outputs the average onto a textbox called Result.I understand how to get it to do the average, but how can I make the program count the numbers that I input and then divided by the sum? Also, how would i get it started.

View 2 Replies

VS 2008 : Code For An Average Of Numbers From 1 To A Number Entered?

Jan 8, 2012

i want to know the code for an average of numbers from 1 to a number entered?

View 31 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved