Displays The Average With An Appropriate Message Before The Average"?
May 10, 2011
I'm in a computer science class, and we are writing simple programs using Visual Basic 2008. I am really inept when it comes to this, as I have never done it before. I need to write a program that: "Asks the user for 5 numbers and computes the average. It then displays the average with an appropriate message before the average."
I have been really close with this, but I can't get the numbers to add up, then divide by 5, and display a pop up message.
I'm working on a function to return a exponential average and there are a lot of examples of exponential moving averages but they all start with a moving average that is just the mean as a lead in to calculating the continuing moving average. I needed just a exponential average of a value set. After Googling my Bing off I still haven't seen anything so here is my attempt at a basic exponential average. Is this correct? Are there any errors? I have seen some text about adding a smoothing value to change the curve of the exponential average but not how that would be implemented.
I have a question regarding average and max values. I am new at programming. I have 6 text boxes with generated numbers in them. I need the max number to show up in one text box and the average to show up in the other.Sometimes not all six boxes will be used so I can't just do textbox1 + textbox2 + textbox3 + textbox4 +textbox5 + textbox6 /6 = average and as for max I have no clue how to do that.
i am trying to get the average of an array of numbers. There could be up to 999 indexes (I picked a large array because of the the numbers of entries the array could have). As you can see I have managed to get the program to calculate the Sum of the in the array, but I am struggling with getting the average.Say, for example, I enter three sets of 90's, I get 3. How do I get an average?(BTW I have programmed it so the numbers go into an List Box, so this is why you see no code to make up the array or to where the array is printing the values).
Dim Sum As Integer Dim SumCount As Integer Dim AverageCount As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim Subject As Integer Subject = InputBox("How many products")
[code]...
Only "0" appears in the TextBox2 and not the average number.
Writing ten(10) input numbers to a text file, and displaying the average in the program, with the two lowest numbers dropped. The project is supposed to allow a user to input 10 number scores and the program will display the average of the scores with the 2 lowest dropped, and write the 10 scores to a text file to display.[code]...
What is the formula in VB for finding the average of two integers?I know in normal math it is e.g. (4 + 6) / 2 it only needs to be the average of two values.
Trying to get the user to put 3 numbers in 3 text boxes and get the average.Private Sub btnAverage_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAverage.Click
Dim a As Integer = CInt(txtone.Text) Dim b As Integer = CInt(txtTwo.Text) Dim c As Integer = CInt(txtThree.Text)
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.
i'm working on something to get the average color from an image and the code i have puts all the rgb values into a byte array, so the values are being stored as (r,g,b,r,g,b,r,g,b,r,g,b,r,g,b,etc). how would i loop through each r value to add them to another array to then be able to calculate the average (and so forth for g and b as well).
here is my problem. i have to enter two grades, each grade should be an integer between 0 and 100 inclusive. Calculate the average of the two grades. If the average is greater than or equal to 90, display "Grade is an A!". It goes down the line for "if average is _______, display " ______is a/n __!" I get the last part and I know how to figure an average...but i am not sure how to type it in code. He did an elseif example, but it wasn't with 2 numbers and didn't have to average anything. So I don't know how to write that code....is there anywhere to look to find it? Here is what I have so far.............
Module Module1 Sub Main() Dim grade, sum, average As Double
Using VB.NET write a program that can calculate the grade of a student based on his or her marks in five subjects as input according to the following rules:
Grade A: For average between 100 and 80 (inclusive) Grade B: For average between 79 and 65 (inclusive) Grade C: For average between 64 and 40 (inclusive)
The idea of this program is to calculate and find total and average for 3 Students automatically. That is when the first data is entered and click on button the total and average of first student should be displayed in listbox. And we should be able to enter second data. Bu the problem is it is just printing the first average and total thrice.
Dim a As String Dim tot, avg, N As Single Dim I As Integer For I = 1 To 3 tot = Val(TextBox2.Text) + Val(TextBox3.Text) + Val(TextBox4.Text) + Val(TextBox5.Text) + Val(TextBox6.Text) [Code] .....
I have being having an issue when trying to find the average between 3 groups, female ("F") , male ("M") and Both Together but it seems that my If statement isn't working as only the "sumOfAllAverage" is showing and the rest is returning an value of "0"
I want to create a program that will let the user input a number and it will go to listbox1. Then listbox2 and 3 will do some algorithms that i made. The only problem that i'm encountering is the average of listbox3.
I have 3 textbox, 1 button, 3 listboxes.the names of the objects is default except to textbox2 and textbox3, I change their name to AveTTTextbox and AveWTTextbox.I use AveTTTextbox to get the output of the average for listbox2 and AveWTTextbox to get the average output of listbox3.[code]....
How can I get the AVERAGE number from the column of ListView1.Items(ListView1.Items.Count - 1).SubItems.Add((reader("High").ToString) - (reader("Low").ToString)) and shows the AVERAGE number on the label.
Dim Cmd As SqlCommand = New SqlCommand(SelectCmd, conn) Dim reader As SqlDataReader reader = Cmd.ExecuteReader()
[code]....
That will be the number i would like to have it on the label.
trying to give an average of an array in VB MVS2008. I tried using a sample code online but the averages it gives me are completely off. If I enter three ages (20) it gives me an average of 0.6, instead of 20. Here's the code:
Spoiler Public Class Form1 Dim Names(100) As String Dim Ages(100) As Integer
I'm using VB Express 2008 with Access 2007 as a database. My problem is getting an average from the database with a query and copying that into my labels. I have a query for every one of the attributes that i want an average for (10 queries). the layout of my database looks like this:
My problem is I have a program that needs to input 3 values in 1 textbox only. I've been trying to figure that out for a couple of days now.this program must show the largest, smallest and average of 3 values.
Public Class Form2 Dim array() As Integer = New Integer() {a, b, c} Dim a, b, c As Integer
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
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
I have written a stopwatch program that has several trials. Each trial is recorded in minutes and seconds in its own label. I would like to find the average time of the trials. I do not know where to start.kobbe
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!