1. pair Programming Project--- arithmetic (ten points)
Basic Functional Requirements:
1) implement a arithmetic with a user interface. 2) The generated topic cannot be duplicated. 3) support negative numbers, such as -1,-1/2,-3 ' 4/5. Reached
Basic setting parameters that need support
1) number of topics 2) range of Values 3) The maximum number of operators in the topic (not currently reached) 4) Whether there are scores in the title or operation (such as when integer division is not possible) 5) is there any multiplication in the topic 6) whether there are brackets in the title (currently not reached) 7) There are no negative numbers in the topic or in the process of operation
Learning experience:
Before their own work alone, will encounter a lot of difficulties alone can not solve, will lead to the work of the delay and other problems, but through this two-person mode (our group is three people) partner to encode, I think in the efficiency of a lot of improvement, and for the work of the degree of seriousness, The understanding of the project is more than one level of depth. In the course of the process, although we have encountered a lot of problems, but through the communication with the great God and have their own access to some of the information, but also successfully solved the problem, but there are some questions that we did not meet the requirements, will continue to follow up.
Knot pair teammate: Yu Yue http://www.cnblogs.com/yuyue1216/Compounding Shuo Http://www.cnblogs.com/dys123hahabalala
Code:
Form 1
usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;usingSystem.Windows.Forms;namespacewindowsformsapplication2{ Public Partial classform1:form {Form2 Form2; PublicForm1 () {InitializeComponent (); Form2=NewForm2 (); } Private voidButton0_click (Objectsender, EventArgs e) {String name= This. Textbox0.text;//get the value insideString Password = This. Textbox0.text; if(name. Equals ("Admin") && password. Equals ("Admin"))//determine if the account password equals admin{MessageBox.Show ("Login Successful"); Form2. ShowDialog (); } Else{MessageBox.Show ("Login failed! "); } } }}
Form 2
usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;usingSystem.Windows.Forms;namespacewindowsformsapplication2{ Public Partial classForm2:form {intN, R1,R2,YSF; FORM3 form3; PublicForm2 () {InitializeComponent (); } Private voidComboBox1_SelectedIndexChanged (Objectsender, EventArgs e) {Combobox1.text=comboBox1.SelectedItem.ToString (); } Private voidButton1_Click (Objectsender, EventArgs e) {Random ran=NewRandom (); N=Convert.ToInt32 (comboBox1.Text.ToString ()); R1=int. Parse (TextBox1.Text); R2=int. Parse (TextBox2.Text); if(comboBox2.SelectedItem.ToString () = ="include") {YSF=4; } Else{YSF=2; } form3=NewFORM3 (n, R1, r2, YSF); Form3. ShowDialog (); } Private voidButton2_Click (Objectsender, EventArgs e) { This. Dispose (); } }}
Form 3
usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;usingSystem.Windows.Forms;namespacewindowsformsapplication2{ Public Partial classForm3:form {Char[] Fuhao = {'+','-','*','%' }; intN, R1, r2, YSF; PublicFORM3 (intNintR1,intR2,intYSF) {InitializeComponent (); This. N =N; This. R1 =R1; This. r2 =R2; This. YSF =YSF; FORM4 FORM4=NewFORM4 (); } Private voidButton1_Click (Objectsender, EventArgs e) {listBox1.Items.Clear (); } Private voidButton5_click (Objectsender, EventArgs e) {application.exit (); } Private voidButton3_Click (Objectsender, EventArgs e) { stringt =""; Random ran=NewRandom (); for(inti =0; I < n; i++) { intNUM1 =ran. Next (R1, r2); intnum2 =ran. Next (R1, r2); if(YSF = =2) {T= Num1 + Fuhao[ran. Next (2)]. ToString () + num2 +"="; } Else{T= Num1 + Fuhao[ran. Next (4)]. ToString () + num2 +"="; } listBox1.Items.Add (t); } } Private voidButton4_Click (Objectsender, EventArgs e) { This. Close (); } }}
Program:
Pair programming Project--arithmetic