Hi . I'm relatively new to programming I just finished a class in VB6 and am now taking vb.net to stay as current as possible.
I'm trying to create program that accepts a number (one at a time) and updates 4 fields with each new number. The fields are Maximum, minimum, average and sum. With each number an array is to be reindexed and the list of inputted numbers is to be displayed in a textbox. I'm supposed to use an array and classes to do this. I'm so lost.
Would someone be able to give me a good place to start? I have a bunch of examples but I can't seem to make the connection between the class and the array.
Thanks to anyone who can help me.
Mike GoldPosted Jan 10, 2008, 11:20 PM
I would start by getting to know some basic OO concepts. Check out this link.
http://www.informit.com/articles/article.aspx?p=25857&seqNum=5
Here is a jumpstart to your homework problem:
1) Drag the TextBoxes on a form (1 for each statistic)
2) Drag labels for each statistic
3) Drag a TextBox for input and Drag a Button next to it
4) double click on the button to produce an event handler and put your calculation code in here
I suspect the professor wants you to use a strategy pattern by creating a class for each stat and each class containing one method calculate. You would override the calculate method in a base class statistics. By creating an instance of each class and placing them in a list or array, you could loop through all the statistics and call calculate.
The Array would be passed into each calculate call to do the calculation for the particular class.
So in essence you could use the Array class twice in your program, once for the list of numbers passed into calculate and one to loop through objects doing the calculation.
Here is an article on arrays to help you understand how to use them for your list of numbers:
http://www.startvbdotnet.com/language/arrays.aspx
I hope this gives you a "jumpstart". Normally I discourage people from helping people with homework, but I think if you try hard to read the article and understand the concepts and then really understand the solution I suggested, you will have learned a good amount of the material.
Best,