C # Small scoring system exercises,
One manager class
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace WindowsFormsApplication1{ class PM { private int num; public int Num { get { return num; } set { num = value; } } private string name; public string Name { get { return name; } set { name = value; } } private int age; public int Age { get { return age; } set { age = value; } } private string sex; public string Sex { get { return sex; } set { sex = value; } } private string zl; public string Zl { get { return zl; } set { zl = value; } } public void ShowJudge(SE se, string assess, string score) { se.Assess = assess; se.Score = score; } } }
// Create an employee class
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace WindowsFormsApplication1{ class SE { private string num; public string Num { get { return num; } set { num = value; } } private string name="0"; public string Name { get { return name; } set { name = value; } } private string age; public string Age { get { return age; } set { age = value; } } private string sex=""; public string Sex { get { return sex; } set { sex = value; } } private int popular; public int Popular { get { return popular; } set { popular = value; } } private string assess=""; public string Assess { get { return assess; } set { assess = value; } } private string score; public string Score { get { return score; } set { score = value; } } }}
// Display and score windows
// Form1 code
Using System; using System. collections. generic; using System. componentModel; using System. data; using System. drawing; using System. linq; using System. text; using System. threading. tasks; using System. windows. forms; namespace WindowsFormsApplication1 {public partial class One: Form {public One () {InitializeComponent ();} public string name2; public string ass; public string score; two frn = new two (); SE [] se = new SE [3]; private void Form1_Load (object sender, EventArgs e) {SE see = new SE (); see. num = "111"; see. name = "James"; see. age = "26"; SE sew = new SE (); sew. num = "112"; sew. name = "Zhou Xinyu"; sew. age = "22"; SE seq = new SE (); seq. num = "113"; seq. name = "Li Si"; seq. age = "30"; see. assess = "not evaluated"; sew. assess = "not evaluated"; seq. assess = "not evaluated"; see. score = ""; sew. score = ""; seq. score = ""; se [0] = see; se [1] = sew; se [2] = seq; MessageBox. show (name2); for (int I = 0; I <se. length; I ++) {ListViewItem ls = new ListViewItem (se [I]. num); ls. subItems. add (se [I]. name); ls. subItems. add (se [I]. age); ls. subItems. add (se [I]. assess); ls. subItems. add (se [I]. score); this. listView1.Items. add (ls) ;}for (int I = 0; I <se. length; I ++) {if (listView1.Items [I]. subItems [1]. text. toString (). equals (name2) {MessageBox. show (ass); listView1.Items [I]. subItems [3]. text = ass; listView1.Items [I]. subItems [4]. text = score ;}} private void listviewincludoubleclick (object sender, EventArgs e) {frn. name = listView1.SelectedItems [0]. subItems [1]. text; frn. ass = listView1.SelectedItems [0]. subItems [3]. text; frn. score = listView1.SelectedItems [0]. subItems [4]. text; frn. show (); this. hide ();}}}
// Form2 code
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;namespace WindowsFormsApplication1{ public partial class two : Form { public string name; public string ass; public string score; public two() { InitializeComponent(); } private void Form2_Load(object sender, EventArgs e) { One fr = new One(); textBox1.Text = name; textBox2.Text = ass; textBox3.Text = score; } private void button1_Click(object sender, EventArgs e) { name = textBox1.Text; ass = textBox2.Text; score = textBox2.Text; One fr = new One(); fr.name2 = textBox1.Text; fr.ass = textBox2.Text; fr.score = textBox3.Text; fr.Show(); this.Hide(); } }}