20145301 Java Programming Experiment two reports: Java Object-Oriented programming Program: Java Programming Experiment Name: Java Object-oriented programming experiment purposes and requirements:
- Initial mastery of unit testing and TDD
- Understanding and mastering object-oriented three elements: encapsulation, inheritance, polymorphism
- Initial mastery of UML modeling
- Familiarity with S.O.L.I.D principles
- Understanding Design Patterns
Experimental content:
- Use TDD to design the complex to implement the plural class
Program Design Ideas: Demand analysis:
Complex operations need to be divided: real and imaginary parts.
Need to run arithmetic, that is, add, subtract, multiply, except four kinds of operations.
Requires the user to have input, so call the Scanner instance, import Java.util.Scanner;
When the user needs to select a different operation, it is implemented with a switch and case statement.
Design
1. Enter a number defined as double-precision floating-point data, X.
2. Then choose the mode of operation, subtraction, through switch and case implementation. 3. Enter the second number defined as double-precision floating-point data, Y. 4. Directly output the corresponding calculation result by System.out.println ().
Program code test results Other experience
The test is the first Java test, get the topic is arithmetic, get the topic feel very simple, but really take to do when found to have encountered a lot of trouble, such as in the definition of scanner class, initially considered ill-conceived, can not pass, for this to ask the classmate, and then to modify to achieve. Programming to later, with the continuous deepening of thinking, found that their coding ability can not be followed by their own thinking, such as how to achieve scores, how to carry out repeated calculations, and so on. So this time only achieved two number of simple four kinds of operations, through the experiment, realized that the practice of knowledge, experience the lack of their own space and progress. Continue to work hard and hope that the next test will make new progress.
PSP (Personal software Process) Time:
| Steps |
Time Consuming |
percentage |
| Demand analysis |
15 minutes |
8.4% |
| Design |
1 hours |
33.3% |
| Code implementation |
50 minutes |
27.7% |
| Test |
10 minutes |
5.6% |
| Analysis Summary |
45 minutes |
25% |
Resources
- "Java Learning Notes"
- Learning Guide for Java Learning notes
- Experiment with familiarity with a Java development environment (Linux + Eclipse)
20145301 Java Programming Experiment two reports: Java Object-oriented programming