20172333 2017-2018-2 "Program Design and Data Structure" Experiment Four Operation Report

20172333 2017-2018-2 "Program Design and Data Structure" Experiment Four Operation Report

1. Paired members

Li Nan20172330

Take on roles (team division)

  • [x] 1. Pre-analysis process
  • Pilot: Yan Yujun
  • Operator: Li Nan
  • Reason: I need to determine what kind of class needs to be written one by one for the entire four operation process, and Li Nan is looking for some methods to implement the class we want to write, and how to write it conveniently and quickly.
  • [x] 2. In the mid-term division of labor and writing
  • This stage is mainly to carry out the division of tasks. Due to the previous discussion, our purpose is clearly divided into three steps. The first is to write a topic class that can randomly generate different levels, and the second is to write a topic class that can be infixed. The class that converts the suffix and outputs the suffix expression and the result will take on my topic. Finally, I will write the class with the method to check whether it is correct, and finally end with a test class.
  • [x] 3. In the later period, various bug fixes and test classes were written
  • Pilot: Li Nan
  • Operator: Yan Yujun
  • Analysis: I write related classes, and Li Nan gives me technical guidance.

2. Demand analysis

Automatically generate questions

  1. Level 1 questions contain only one operator (including addition, subtraction, multiplication and division).
  2. Level 2 questions contain four operators. And so on.
  3. Level 4 questions support true scores.
  4. All questions are within 100.
  5. Once the question is created define a variable to get the result of the answer
  6. Is the question bank input in advance or when it comes to use Random for random use? (It is currently set as a method, in which the level and number required by the user are read to randomly output the question)
  7. There is no limit to the number of questions. (not yet available)

    topic operation

    1. Convert infix expressions to postfix expressions.

  8. Use the stack to perform the conversion process (the question is how to convert). picture

2. Determine whether the user answers the question right or wrong, and output the correct result

1. Use the Scanner class for the result of the user's answer, assign its value to a specific variable, and use the ifstatement to determine and output the correct or wrong results respectively, ifand output the answer after the statement.

3. Problems encountered during the experiment and the solution process

Question 1: When writing the class generated by the title, the main method is defined as the main thing

Solution to problem 1 : During the writing process, individuals feel bored and inefficient about defining a method first, and then using the method in a test class. Obviously, it can be ended directly in a Main method, so why write another test class? , then I spent a night compiling the program, and found that when I wanted to export my question to Li Nan to test his method, I found that I couldn't do it anyway. After seeking help from senior Zhang Xusheng, he gave me a fatal blow. Hit, he said that the Main method cannot be inherited, it has always been inheritance between classes. To put it succinctly, it means that the things I have done overnight must be re-transformed into methods in the classes I hated before before they can be exported.

Question 2: An error occurred when exchanging questions between the question generation class and the infix-to-suffix class.

Solution to problem 2 : When the user only needs a single question to convert, the two conversions are perfect, but the question generator I designed can generate multiple questions at one time, which leads to a slight problem in the connection, probably The class created by Li Nan only accepts the title I finally generated. (not yet resolved)

4. Uml diagrams

picture

5. Pair evaluation

Li Nan : As my only teammate, and I have undertaken the relatively difficult compilation of infix-to-suffix classes, there is not much problem. I think it is very nice, and my teammates are still very cow.

6. Timetable (not yet summarized and completed)

References

2017-2018-2 1723 "Java Programming" Course Pair Programming Exercise_Four Operations

Pair Programming Project - Four Arithmetic

SOLID principles

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325118130&siteId=291194637