Homework 05 - Inheritance, Polymorphism, Abstract Classes and Interfaces

1. This week's learning summary

1.1 Write down the key words of knowledge points that you think are more important in this week's study
1.2 Try to use the mind map to organize these key words. Note: Mind maps generally do not require too many words.
1.3 Optional: Summarize other lesson content using conventional methods.

2. Written work

Homework Reference File Download
Question Set: Object-Oriented 2-Advanced-Polymorphism, Interfaces and Inner Classes

1. Object-oriented design work (team project, 2-3 people)

Content: Continue to improve the last big homework.
Note: Java GUI programming will be taught in a few more lessons, and the system will be upgraded to a GUI at that time. The business logic part of the system should not change much, but the input and output parts should change greatly. When coding, please do not tie the code that handles input (System.in) and output (System.out) to a business processing method.
References:

Drawing with Processon

The job submission structure is as follows:

1.1 Project introduction form:

Project code cloud address (you can directly jump to the home page of the project if required after clicking).
Team Member Form

student responsible for the task blog address
Zhang San Which classes are written Zhang San's Blog Link
Li Si Which classes are written Li Si's Blog Connection

1.2 The common function frame diagram or flow chart of the system


Tip: In the XMind text box, you can press Shift+Enterto make words stand up.
1.3 System overall class diagram
Class diagram drawing reference materials:

A summary of several relationships in UML class diagrams

1.4 Screenshots of shopping carts, commodities, and key codes of the system (mainly capture the part that you are responsible for)
1.5 Others: Compared with the last system, what changes have been made to the design of the system. other thoughts.

2. abstract: Read the design and use source code of the GuessGame abstract class

2.1 Guess The code before the transformation is very simple, but the transformed code uses abstract classes and abstract methods, which looks more complicated. What is the benefit of such a transformation? There are abstract methods and non-abstract methods in
2.2 . What kind of methods do you think should be declared in an abstract class, and what methods do not need to be declared for direct implementation. 2.3 Important: In this example, what changes and what does not change? Try to explain with concepts such as abstract.GuessGame(改造后).javaabstractabstract

3. Comparable与Comparator

3.1 Combined with your code description in PTA 7-1, why can you directly use Arrays.sort to sort an array of this type if a class implements the Comparable interface?
3.2 Combined with your code description in PTA 7-2, why do you need the Comparator interface when you have the Comparable interface?
3.3 In the previous assignment Shape, Rectangle,Cirlce, what method in the Shape class should be declared abstract? Say why.
3.4 There are many Shape type objects such as Rectangle and Circle. Want to use Arrays.sort to sort them, please write the corresponding code. And briefly describe which class should implement the Comparableinterface better? Why?
3.5 Taking the code you wrote in 3.4 as an example, briefly describe the benefits of programming for Comparable interfaces and programming for parent classes. (Note: Be sure to combine your own code)

4. Interface-oriented case analysis

Read Case-StudentDao.zip case
4.1 a. Draw a class diagram. b. StudentDaoWhat is the use of the interface?
What does 4.2 have in common StudenDaoListImplwith StudentDaoArrayImpl? What's the difference?
4.3 Combined with the main function in Test.java, briefly describe what is interface-oriented? What are the benefits of programming to an interface?

5. Optional: Code Reading: Source Code in Child Compressed Package

5.1 Can the Child.java file in the com.parent package be compiled and passed? Which sentence will cause an error? Try to correct this error. and analyze the output.
5.2 Can OutOfParentPackage.java in another package be compiled and passed? What error is prompted?
5.3 What protectedshould I do in order to access a decorated property or method?

3. Code cloud and PTA

Topic set: object-oriented 2-advanced-polymorphic interface inner class

3.1. Code cloud code submission record

  • In the code cloud project, select "Statistics-Commits History-Set Time Period", then search and take a screenshot

3.2 Screenshot PTA Question Set Completion Chart

Two graphs are required (1. Rank graph. 2. PTA submission list graph)

3.3 Count the amount of code completed this week

The weekly code statistics need to be merged into one table.

Guess you like

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