如何上课平均 [英] how to class average

查看:86
本文介绍了如何上课平均的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何计算用户输入的最多30个数字的平均值并存储在数组中。程序应该使用一个名为statistics的类,并且有一个stornumber方法,一次将数字存储到一个数组中。该类应具有一个计数属性,用于跟踪存储的数字,一个名为average的方法返回该数字的平均值。我有2个文本框和2个按钮



文本框1 =数字



textbox2 =只读平均结果



按钮1 =记录号码



按钮2 =计算平均值



请求今天回答我的问题

how to make calculates the average of up to 30 numbers input by the user and stored in array . the program should use a class named statistical and have an stornumber method that stores number into an array one at a time . the class should have a count property that keeps track of the number stored and a method called average the returns the average of the number . i have 2 textbox and 2 button

textbox 1 = number

textbox2 = read only result of average

button 1 = record the number

button 2 = calculates the average

pleas answer my q today

推荐答案

我们不做你的功课:这是有原因的。它就是为了让你思考你被告知的事情,并试着理解它。它也在那里,以便您的导师可以识别您身体虚弱的区域,并将更多的注意力集中在补救措施上。



亲自尝试,你可能会发现它不是和你想的一样困难!



这并不困难:一个For Each循环通过数组,将所有值相加。除以数组中的值的数量,你就得到了平均值......
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

This isn't difficult: a For Each loop through the array, adding up all the values. Divide by the number of values in the array, and you have the average...


这篇关于如何上课平均的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆