Page 385 - Computer_Science_F5
P. 385

Computer Science  5.  Describe how polymorphism is   (2) Identify requirements
                                                        (a)  Features: List all functionalities
                achieved through inheritance and
                                                             the application should have.
                method overriding in Java. Provide
                                                             i.  Example: User
                a practical example to illustrate the
                                                               authentication, data input,
          FOR ONLINE READING ONLY
                concept.
             6.  Explain the role of dynamic method            reporting.
                dispatch in achieving runtime           (b)  Data inputs: Identify the types of
                                                             data the application will handle.
                polymorphism in Java. How does               i.  Example: User details,
                it enable method invocation based              transaction data.

                on the actual object type?
             7.  Design a Java program that             (c)  Outputs: Define what the
                                                             application will produce.
                demonstrates both compile-time               Example: Reports, notifications.
                and runtime polymorphism. Include
                examples of method overloading       (3) Create a design document
                and method overriding to showcase       (a)  Outline classes: List all classes
                the flexibility of polymorphic               with a brief description.
                behavior.                               (b)  Methods and relationships:

             8.  How does the Java compiler                  (i) Detail methods for each class.
                determine which overloaded
                method to call during compile-time           (ii) Describe how classes interact.
                polymorphism?                        Stage Two: Designing classes and
                                                                    relationships

           Building an application with Python       (1) Class diagrams
           When building any program in this section,   (i)  Purpose: Provide a visual
           there are several stages to undergo. The          representation of classes and their
           following are three major stages:                 interactions.

           Stage One: Planning the project              (ii)  Tools: Use diagramming software
                                                             like UML or simple drawings.
           (1) Define objectives

               (a)  Purpose: Clearly articulate what  (2) Key considerations
                   the application aims to achieve.     (a)  Encapsulation:
               (b)  Goals: Specify the desired               (i) Keep data private within
                   outcomes, such as improving                 classes.
                   efficiency or solving a particular        (ii) Provide public methods to
                   problem.                                    access and modify data safely.


                                                 376
                                                                for Advanced Secondary Schools



     Computer Science Form 5.indd   376                                                     23/07/2024   12:34
   380   381   382   383   384   385   386   387   388   389   390