Personal software engineering jobs 03, software engineering jobs 03

Source: Internet
Author: User
Tags net time

Personal software engineering jobs 03, software engineering jobs 03

 

 

Arithmetic Operation 03

Project Plan log

Name: lvzekun;

Date: 2016.3.22

Task Lectures Reading Design Write Conclusion Working hours  
Monday 8---9.40 15.30 --- 16.00 13.00 -- 15.00   4.00  
Tuesday   15.00 -- 16.30     1.30  
Wednesday            
Thursday            
Friday     17.00 -- 19.00   2.00  
Saturday    

10.00-11.30

13.00 -- 18.00

  6.30  
             

Time record log:

Name: Lu Zekun

Date Start Time Interruption time NET Time Activity Remarks  
3.21 15.30 --- 16.00 16.00 3.00 Post a blog    
3.22 15.00 -- 16.30
  1.30 Read, Write Design Bath
       
3.24 15.00 -- 16.30 16.30 1.30 Read, Write Design Bath  
3.26.2016

10.00-11.30

13.00 -- 18.00

11.30 6.30 Program writing Lunch break  
             
             

Defect log

Name: Lu Zekun

Date: 3.22.2016

Date

No.

Type Introduction phase Division stage Time repaired Repair defects
3.22

 

. 01

Encoding Compile Lmin    
Description

Syntax error: missing ') 'before '! '

 

         
3.26 02 Encoding Compile Lmin    
Description  

Huanstr = Int_Str (p); Error

         
3.26 03 Encoding Compile Lmin    
Description Description: The knowledge points are not strong when designing the function structure and variables, such as the use of address transmission parameters.          
3.26 04 Encoding Compile Lmin    
Description : When re-checking a function is compiled, the program cannot effectively re-check because of the I and j Problems of the inner and outer loops.          

Program name: Four arithmetic operations 2

Lab requirements:

1. The program written by the student must be able to determine whether the user's input answer is correct,
For example, program output: 20-5 =? If you enter 15, the program will report the correct information and continue to issue the question. After 30 questions are completed, the program finally tells the user how many questions have been answered.
2. The program must be able to process the mixed formula of the four operations;
20-5*2 =? The correct answer is 10.
20-5*2 + 9/3 =? The correct answer is 13.
Note:
Continuous subtraction and division should follow the left combination rules.
Parentheses are required for continuous division. Otherwise, ambiguity may occur.

Design Concept:

Step 1: // determine the value range and value of the question. And make judgments,

Select the printing method of the second step;

Step 3 brackets

Step 4: Construct the output function and determine the function

Step 5 select addition and subtraction or four arithmetic operations

Is there a negative number in step 1 addition and subtraction?

Part 7 judge the remainder

Determine whether a real score exists

Judge the definition array to cycle the question

Simple and hybrid operations

Work:

Lab:

 

Lab code:

Import java. util. extends; public class Four_Operation_03 {static variables in = new classes (System. in); public static void main (String [] args) {// TODO Auto-generated method stub System. out. print ("select \ n1. hybrid operation; \ n2. simple operation. \ N "); int k = in. nextInt (); System. out. print ("select \ n calculation range: \ n"); int numF = in. nextInt (); // numF: the calculation range is System. out. print ("2. select whether multiplication or division exists: \ n "); System. out. print ("(1): Yes (2): NO \ n"); int ccYN = in. nextInt (); // ccYN: whether there is a multiplication and division System. out. print ("4. whether there are negative numbers in addition and subtraction: \ n "); System. out. print ("(1): Yes (2): NO \ n"); int fushu = in. nextInt (); // fushu: whether there is a negative number if (k = 1) {operationComp (numF, ccYN, fushu);} else if (k = 2) {operationInt (numF, ccYN, fushu) ;}/// Simple public static void operationInt (int a1, int a2, int a3) {// negative integer int a4 = 5 in the range of multiplication and division; // print the number of int fir [] = new int [a4]; // The first number of int mid [] = new int [a4]; // The intermediate variable char fh [] = new char [a4]; // The symbol int sec [] = new int [a4]; // The second number of int T; // control the variable for re-generating random numbers (int I = 0; I <a4; I ++) {T = 0; // random generation of fir [I] = (int) (Math. random () * a1); mid [I] = (int) (Math. random () * a1); if (a2 = 2) {mid [I] = mid [I] % 2; if (mid [I] = 0) fh [I] = '+'; if (mi D [I] = 1) fh [I] = '-';} if (a2 = 1) {mid [I] = mid [I] % 4; if (mid [I] = 0) fh [I] = '+'; if (mid [I] = 1) fh [I] = '-'; if (mid [I] = 2) fh [I] = '*'; if (mid [I] = 3) fh [I] = '/';} sec [I] = (int) (Math. random () * a1); if (fh [I] = '/') {while (sec [I] = 0) {sec [I] = (int) (Math. random () * a1);} if (fir [I] % sec [I]! = 0) {T = 1 ;}/// negative if (a3 = 2) {if (fh [I] = '-') {if (fir [I]-sec [I] <0) T = 1 ;}// whether repeated for (int j = I-1; j> = 0; j --) {if (fh [I] = fh [j]) {// determine whether the number is the same if (fir [I] = fir [j] & sec [I] = sec [j]) T = 1; // numbers before and after addition and multiplication cannot be the same if (fh [I] = '+' | fh [I] = '/') {if (fir [I] = sec [j] & sec [I] = fir [j]) T = 1 ;}} if (T = 1) I --;} // print int R = 0; for (int m = 0; m <a4; m ++) {System. out. print (fir [m]); System. out. print (fh [m]); System. out. print (sec [m]); System. out. print ("="); // System. out. print (fir [m] + fh [m] + sec [m] + "="); int r1 = in. nextInt (); int r2 = 0; if (fh [m] = '+') {r2 = fir [m] + sec [m];} if (fh [m] = '-') {r2 = fir [m]-sec [m];} if (fh [m] = '*') {r2 = fir [m] * sec [m];} if (fh [m] = '/') {r2 = fir [m]/sec [m];} if (r1 = r2) R ++;} System. out. print (R) ;}// mixed public static void operationComp (int b1, int b2, int b3) {// The negative integer int b4 = 5 in the range of multiplication and division; // print quantity // int numope [] = new int [b4]; // number of operators that generate a hybrid operation int num [] = new int [5]; // char fuh [] = new char [4]; // int mid1; // symbol intermediate conversion variable/* // random generation of mixed computing complexity for (int m = 0; m <b4; m ++) {numope [m] = (int) (Math. random () * 2); // random generation of mixed computing complexity numope [m] = numope [m] + 3;} */System. out. print ("Enter the complexity of the Hybrid Operation: \ n"); int numope = in. nextInt (); for (int k = 0; k <b4; k ++) {for (int I = 0; I <5; I ++) {num [I] = (int) (Math. random () * b1);} for (int j = 0; j <4; j ++) {mid1 = (int) (Math. random () * 100); if (b2 = 1) // with or without multiplication and division {if (mid1% 4 = 0) fuh [j] = '+ '; if (mid1% 4 = 1) fuh [j] = '-'; if (mid1% 4 = 2) fuh [j] = '*'; if (mid1% 4 = 3) fuh [j] = '/';} if (b2 = 2) {if (mid1% 2 = 0) fuh [j] = '+'; if (mid1% 2 = 1) fuh [j] = '-' ;}// fuh [4] = '; // print int N = 0; for (int n = 0; n <numope-1; n ++) {System. out. print (num [n]); System. out. print (fuh [n]); N ++;} System. out. print (num [N]); System. out. print ("= \ n ");}}}

 

 

 

 

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.