Originally posted by: covert24
nvm i misunderstood my teacher when she told us what to do. so it turns out you just have to enter in data into a input box and get the average. i dont know how to do that for a gpa tho with the decimal in it. so just disregard my first post and help me with this post. thanks. and im using VB
I don't mean to beat up on you, but I'm personally not going to answer any more posts from people who are supposedly training to be programmers, but can't take the time to capitalize the right letters, and spell out all the words. The profession that you are training for is one in which it is somewhat important to capitalize the right letters, and spell out all the words.
For your problem, you need to decide the two things that you always need to decide for such problems: a) in what form will I receive the input; and b) how do I transform the input according to the rules I have been given. Oh, and maybe there's a third: how do I display the output? But let's not reach for the stars here.
You're going to be getting the GPAs in a test box, I assume. That means the user is entering a string (that's a bit of text). That string might look like this: "3.2"; or this: "3.20"; or this: "booyah!" You need to first make sure the text is in a form that you can convert to a number.
Then you need to put the number in a form for your internal calculations. If you need to work with decimal places you can use float, double, decimal, or whatever Visual Basic calls such values (probably "NumberThingie"). You can either convert the text directly to one of those types, or you may be able to take shortcuts.
For example, if everyone enters either 3, 3.0, 3.2, or 3.20 just make sure to pad out as needed so that you always start with 3.00 or 3.20, then multiple by 100 and put the result into an int, do your calculations, and divide the result by 100 and store it in a float. Then convert the float to text and display it.