exam average
namespace Exams_Average { public partial class examAverageForm : Form { public examAverageForm() { InitializeComponent(); } private void examAverageForm_Load(object sender, EventArgs e) { } private void exitButton_Click(object sender, EventArgs e) { Close(); } private void calculateButton_Click(object sender, EventArgs e) { // Declare variables to store the input data and the output data int examScore1, examScore2, examScore3; float examAverage; try { // Convert data in the text boxes used for input into the appropriate // data type and store in corresponding variables examScore1 = int.Parse(exam1TextBox.Text); examScore2 = int.Parse(exam2TextBox.Text); examScore3 = int.Parse(exam3TextBox.Text); // Process the input data into the output data examAverage = (examScore1 + examScore2 + examScore3) / (float)3.0; // Convert output data variables to a string and // assign the result to the proper output control averageLabel.Text = examAverage.ToString(); } catch { MessageBox.Show("Invalid Exam 1 Score", "Data Entry Error", MessageBoxButtons.OK, MessageBoxIcon.Error); exam1TextBox.Focus(); exam1TextBox.Select(); } } private void exam2TextBox_Click(object sender, EventArgs e) { } } }
- 1
- 粉丝: 0
- 资源: 2
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助