1. Study summary of this week 1.1 write down the key points of knowledge that you think are important in your study this week
Keywords: interface
1.2 Try to organize these keywords using mind mapping. Note: Mind mapping generally does not need to appear too many words.
2. Written assignment 1. Object-oriented design job (team project, 2-3 people)
Content: Continue to improve the last big job.
Note: After a few more classes to talk about Java Graphics interface programming, the time to upgrade the system to a graphical interface. The part of the business logic of the system should not change much, the change is the part of the input and output. When encoding, do not bind the code that handles input (system.in) and output (System.out) to a business processing method.
1.1 Project Introduction Form:
Student |
responsible for the task |
Blog Address |
Yechong Pine |
ShoppingCart class, Main function |
https://www.cnblogs.com/jerkol/ |
Ma Yulan |
Goods abstract class, BOOLR class, user class |
http://www.cnblogs.com/288myl/ |
1.2 System common function frame diagram
1.3 System General Class diagram
1.4 Shopping cart, commodity, System key code (mainly to intercept own responsible parts)
1.5 Other: Compared with the previous system, the design of the system and other changes. Other impressions.
The amount of knowledge is still very insufficient, there are a lot of places to write the wrong, just make a part of the rest of the access to the information after the completion
2. Abstract: Reading Guessgame abstract class design and use of source code 2.1 guess the pre-transformation code is simple, and the modified code uses abstract classes, abstract methods, it seems more complex, what is the benefit of such a transformation?
Before the transformation, only through the console input and output, no use of abstract classes.
After the transformation, the use of the abstract class, can be input and output at different interfaces
2.2 Guessgame (after transformation). There are abstract and non-abstract methods in Java, and you think that what methods in the abstract class should be declared abstract, and what methods do not need to be declared as abstract directly implemented.
In an abstract class, you need to declare certain methods that are not deterministic, and abstract
if you directly determine a method that is not declared abstract, the direct implementation can
2.3 Important: In this case, what is the change and what is the same? Try to describe it in conjunction with concepts such as abstract.
3. Comparable and Comparator3.1 combined with PTA 7-1 your code explains why a class implements the comparable interface, so you can use Arrays.sort to sort an array of that type directly.
Comparable interface is a sort of comparison between objects, using comparable interface, in this class there is CompareTo method, you can directly use Arrays.sort sort.
3.2 Combined with the PTA 7-2 in your code description, with the comparable interface why still need comparator interface?
To define the CompareTo method in a class to use Arrays.sort to sort the input array, comparator can define CompareTo methods outside the class, and then sort the arrays with collections.sort methods.
3.3 Previous jobs shape, rectangle,cirlce, what methods in the shape class should be declared abstract? Tell the reason.
The Getperimeter () method (perimeter) in the shape class, the Getarea () method (area) should be declared abstract, its subclasses are not the same as the algorithm for area and perimeter, it is necessary to declare the method of calculating perimeter and area in the same parent class
3.4 There are many shape-type objects such as rectangle, Circle. If you want to use Arrays.sort to sort them out, write the appropriate code. And a brief description of which class should be implemented comparable interface is better?
To sort them by area:
Better in the Shape class
3.5 Take the 3.4 code you write as an example, outlining the benefits of programming for comparable interfaces and for parent-class programming. (Note: Be sure to combine the code you wrote)
Using the comparable interface for the parent class programming, the CompareTo method is declared as the abstract type, followed by code writing in its subclasses, sorting the parent class without regard to its specific class, and then completing the sort.
4. Interface-oriented case Analysis 4.1 a. Draw a class diagram. What is the use of the B.studentdao interface?
Student class: A simple Class
Studentdao interface: There are three abstract methods: Read-write, display student
What do 4.2 Studendaolistimpl and Studentdaoarrayimpl have in common? What's the difference?
In common: Both use the Studentdao interface
Differences: There is a size limit for using Studentdaoarrayimpl, and there is no size limit for using Studendaolistimpl, because the list specifies that if size is outside the array, it will be given a size length space.
4.3 The benefits of interface-oriented programming are outlined in conjunction with the main function in Test.java.
Increased resiliency and maintainability
5. What is interface-oriented programming? What are the benefits of interface-oriented programming?
Defines an interface that provides an abstract approach to classes that inherit this interface is interface-oriented programming
Increased resiliency and maintainability
3. Code Cloud and PTA
Topic set: Object-oriented 2-advanced-polymorphic interface inner class
3.1. Code Cloud codes Submission record
3.2 PTA Problem set complete situation diagram
3.3 Count the amount of code completed this week
Week Time |
Total code Amount |
New Code Volume |
total number of files |
number of new files |
1 |
330 |
330 |
5 |
5 |
2 |
625 |
322 |
11 |
6 |
3 |
1047 |
422 |
16 |
5 |
4 |
1472 |
425 |
21st |
5 |
6 |
1978 |
506 |
27 |
6 |
201621123030 Java Programming 5th Week of study summary