Java Interfaces: Properties, Extending, and Implementing, Exercises of Programming Languages

The concept of Java interfaces, their properties such as abstract methods, constants, default methods, and static methods. It also covers the process of declaring interfaces, extending interfaces, and implementing interfaces with examples. a part of Object-Oriented Programming (OOP101) course materials from Norzagaray College.

Typology: Exercises

2020/2021

Uploaded on 07/01/2021

felizardo-etiong-jr
felizardo-etiong-jr 🇺🇸

4 documents

1 / 11

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
TABLE OF CONTENTS
LEARNING TASK 11-12 ................................................................................................. 1
INTERFACES ..................................................................................................... 1
ACTIVITY 11-12 ............................................................................................................. 1
PRE-ASSESSMENT 11-12 ............................................................................................ 1
CONTENT DEVELOPMENT 11-12 ................................................................................ 1
POST-ASSESSMENT 11-12 .......................................................................................... 4
LEARNING TASK 13 ...................................................................................................... 4
CASE STUDY CREATION PROPOSAL USING OOP APPROACH.................... 4
ACTIVITY 13-14 ............................................................................................................. 5
PRE-ASSESSMENT 13-14 ............................................................................................ 5
CONTENT DEVELOPMENT 13-14 ................................................................................ 5
POST-ASSESSMENT 13-14 .......................................................................................... 6
LEARNING TASK 15 ...................................................................................................... 7
PROTOTYPE FORMAT AND REQUIREMENTS ................................................ 7
ACTIVITY 15 .................................................................................................................. 7
PRE-ASSESSMENT 15 ................................................................................................. 7
CONTENT DEVELOPMENT 15 ..................................................................................... 7
POST-ASSESSMENT 15 ..............................................................................................10
FINAL EXAMINATION ...................................................................................................11
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Java Interfaces: Properties, Extending, and Implementing and more Exercises Programming Languages in PDF only on Docsity!

TABLE OF CONTENTS

  • LEARNING TASK 11-12
    •  INTERFACES
  • ACTIVITY 11-12
  • PRE-ASSESSMENT 11-12
  • CONTENT DEVELOPMENT 11-12
  • POST-ASSESSMENT 11-12
  • LEARNING TASK
    •  CASE STUDY CREATION PROPOSAL USING OOP APPROACH....................
  • ACTIVITY 13-14
  • PRE-ASSESSMENT 13-14
  • CONTENT DEVELOPMENT 13-14
  • POST-ASSESSMENT 13-14
  • LEARNING TASK
    •  PROTOTYPE FORMAT AND REQUIREMENTS
  • ACTIVITY
  • PRE-ASSESSMENT
  • CONTENT DEVELOPMENT
  • POST-ASSESSMENT 15 ..............................................................................................
  • FINAL EXAMINATION...................................................................................................

Property of Norzagaray College OOP Object-Oriented Programming

LEARNING TASK 11-12 ()

TOPIC

 INTERFACES

TOPIC OVERVIEW

Learning Task 11 to 12 will focus on the concepts and Methods of Interfaces DESIRED LEARNING OUTCOMES At the end of this learning task, students should be able to:

  1. Know the importance of creating an interface in the Application.
  2. Develop the creativity and analyzation of creating an Interface in your application

ACTIVITY 11- NAME: _________________________________ COURSE & SECTION: _____SCORE: _____ Directions: Answer the questions in a yellow paper. 1. Read and study a technological Journal on the latest trend in creating a Java App using OOP approach 2. Write the title, author, website and published date, include the journal that you chose. 3. Write your reaction on the journal that you chose (this requires 300 words or more)


PRE-ASSESSMENT 11- NAME: _________________________________________ COURSE & SECTION: _________ Answer the following questions in a yellow of paper. 10pts each.

  1. What is Interface in your own words? Explain
  2. List some of the features of Interface.
  3. What are the importance of Interface in designing a System. Explain. CONTENT DEVELOPMENT 11- INTERFACES An interface is a reference type in Java. It is similar to class. It is a collection of abstract methods. A class implements an interface, thereby inheriting the abstract methods of the interface. Along with abstract methods, an interface may also contain constants, default methods, static methods, and nested types. Method bodies exist only for default methods and static methods. Writing an interface is similar to writing a class. But a class describes the attributes and behaviors of an object. And an interface contains behaviors that a class implements. Unless the class that implements the interface is abstract, all the methods of the interface need to be defined in the class. An interface is similar to a class in the following ways −  An interface can contain any number of methods.  An interface is written in a file with a .java extension, with the name of the interface matching the name of the file.  The byte code of an interface appears in a .class file.  Interfaces appear in packages, and their corresponding bytecode file must be in a directory structure that matches the package name. However, an interface is different from a class in several ways, including −

Property of Norzagaray College OOP Object-Oriented Programming public static void main(String args[]) { MammalInt m = new MammalInt(); m.eat(); m.travel(); } } This will produce the following result −

Output

Mammal eats Mammal travels When overriding methods defined in interfaces, there are several rules to be followed −  Checked exceptions should not be declared on implementation methods other than the ones declared by the interface method or subclasses of those declared by the interface method.  The signature of the interface method and the same return type or subtype should be maintained when overriding the methods.  An implementation class itself can be abstract and if so, interface methods need not be implemented. When implementation interfaces, there are several rules −  A class can implement more than one interface at a time.  A class can extend only one class, but implement many interfaces.  An interface can extend another interface, in a similar way as a class can extend another class. Extending Interfaces An interface can extend another interface in the same way that a class can extend another class. The extends keyword is used to extend an interface, and the child interface inherits the methods of the parent interface. The following Sports interface is extended by Hockey and Football interfaces.

Example

// Filename: Sports.java public interface Sports { public void setHomeTeam(String name); public void setVisitingTeam(String name); } // Filename: Football.java public interface Football extends Sports { public void homeTeamScored(int points); public void visitingTeamScored(int points); public void endOfQuarter(int quarter); } // Filename: Hockey.java public interface Hockey extends Sports { public void homeGoalScored(); public void visitingGoalScored(); public void endOfPeriod(int period); public void overtimePeriod(int ot); } The Hockey interface has four methods, but it inherits two from Sports; thus, a class that implements Hockey needs to implement all six methods. Similarly, a class that implements Football needs to define the three methods from Football and the two methods from Sports.

Property of Norzagaray College OOP Object-Oriented Programming Extending Multiple Interfaces A Java class can only extend one parent class. Multiple inheritance is not allowed. Interfaces are not classes, however, and an interface can extend more than one parent interface. The extends keyword is used once, and the parent interfaces are declared in a comma-separated list. For example, if the Hockey interface extended both Sports and Event, it would be declared as − Example public interface Hockey extends Sports, Event Tagging Interfaces The most common use of extending interfaces occurs when the parent interface does not contain any methods. For example, the MouseListener interface in the java.awt.event package extended java.util.EventListener, which is defined as − Example package java.util; public interface EventListener {} An interface with no methods in it is referred to as a tagging interface. There are two basic design purposes of tagging interfaces − Creates a common parent − As with the EventListener interface, which is extended by dozens of other interfaces in the Java API, you can use a tagging interface to create a common parent among a group of interfaces. For example, when an interface extends EventListener, the JVM knows that this particular interface is going to be used in an event delegation scenario. Adds a data type to a class − This situation is where the term, tagging comes from. A class that implements a tagging interface does not need to define any methods (since the interface does not have any), but the class becomes an interface type through polymorphism.


POST-ASSESSMENT 11- NAME: ____________________________ COURSE & SECTION: ______ SCORE: ____ A. Essay. Write your answer in a yellow paper. 100 pts

  1. Create a simple inventory program with Interface a. Program should have at least 3-4 OOP Concepts. b. Your program should be user friendly and with professional design c. In your code be sure to add a Comment about the OOP concepts that you use your functions
  2. Create the pseudocode and flowchart of your program

LEARNING TASK 13-14() TOPIC CASE STUDY CREATION PROPOSAL USING OOP APPROACH TOPIC OVERVIEW Learning Task 13 to 14 will focus on Case Study Creation using OOP Approach for subject completion DESIRED LEARNING OUTCOMES At the end of this learning task, students should be able to: 1. Identify the importance of creating a case study 2. Develop the creativity and analyzation creating an OOP system approach 3. Develop the Systems Analysis and Code Optimization

Property of Norzagaray College OOP Object-Oriented Programming

2. Accounting or Mobile Accounting System

is the ability to access and process accounting information, which could be data, applications, etc. over the devices that are not restricted by the physical locations. That means you can access data or applications from anywhere using the tablet, laptop, smartphone, and other internet-connected devices. With certain solutions, you do not even require to download or install the application on the local device. Your internet browser can deliver that for you. It also means operations such as – managing financial transactions, maintaining payrolls, calculating taxes, etc., can be processed and monitored by the user over handheld devices without being in the office premises. The idea is to let the accounting operations continue over a device that the user is familiar and comfortable with. So, check WhatsApp messages from friends and also file the taxes for the client at the fingertips without any disruption. Why Mobile Accounting? Since the accuracy and security of accounting are as critical for businesses as for professionals, reliability has to be a necessary element with every innovation in the accounting industry. The rising abilities of mobile devices and improvements with security solutions have enhanced the reliability of mobile accounting solutions. According to a survey report by Software Advice, 64% of the respondents could access the mobile version of their accounting app. On the other hand, 36% of users said they could only access it through a mobile browser. However, there was no respondent who could not access the information through their smartphones.

3. Human resource management app/system

Human resource software is designed to help employees and management perform at their full potential and is implemented by businesses of all sizes to boost productivity and overall employee satisfaction. Effective human resources software will integrate recruiting, onboarding, workforce management, time scheduling and management, payroll solutions and strategic human capital management. Human resources software is sometimes called human resource management systems (HRMS), human capital management (HCM) and Human resources information systems (HRIS). Though each term sounds different, they all refer to the system a company uses to effectively manage employees.

4.School enrollment System

an enrollment system combines all activities involved in the entire enrollment process and integrates them into a system. This way, everything happens in one place, both online and offline. The conversation happened with the prospects, the pages they are visiting, their interests and motivations, their personal details, the meetings scheduled with them to name a few. The overall

objective of an enrollment system is to help admission teams ultimately enroll more students.

5.E-commerce

Ecommerce, also known as electronic commerce or internet commerce, refers to the buying and selling of goods or services using the internet, and the transfer of money and data to execute these transactions. Ecommerce is often used to refer to the sale of physical products online, but it can also describe any kind of commercial transaction that is facilitated through the internet


POST-ASSESSMENT 13- NAME: ____________________________ COURSE & SECTION: ______ SCORE: ____ A. Essay. You can write this in word or pdf format. 10 pts each

  1. Differentiate Prototyping from Production Development. Explain.
  2. Give some sample of e-comerce softwares and describe each 3 Differentiate Agile Methodology from Waterfall Methodology. Explain. B Programming. 100 pts.
    1. Create a Scheduler Program.

Property of Norzagaray College OOP Object-Oriented Programming

  1. Based on your Source Code identify the OOP concepts that you use and describe each functions.
  2. Show the output of your program

LEARNING TASK 15() TOPIC  PROTOTYPE FORMAT AND REQUIREMENTS Learning Task 13-14 will discuss the Prototype of the software and requirements to develop a functional Mobile Application for Case Study DESIRED LEARNING OUTCOMES: At the end of this learning task, students should be able to:

  1. How to create a functional Application using OOP Approach for Case Study
  2. Identify the Requirements needed to properly present a Case Study
  3. Analyze the importance of Prototyping in creating a quality software.

ACTIVITY 15 NAME: _________________________________ COURSE & SECTION: _____SCORE: _____ Answer the following questions. Use a separate sheet of paper for your answer. 10 pts. each.

  1. What are the requirements to complete a Case Study.
  2. Is survey important in your Case Study? Explain.
  3. What are the tools that you use to create your case study? Do you use Prototyping tool? Describe.

PRE-ASSESSMENT 15 NAME: _________________________________________ COURSE & SECTION: _________ Answer the following questions. Use a separate sheet of paper for your answer. 30 pts.

  1. Read and study a technological Journal about Software Prototyping
  2. Write the title, author, website and published date, include the journal that you chose.
  3. Write your reaction on the journal that you chose and describe the importance of Creating a Prototype for your Case Study

CONTENT DEVELOPMENT 15

PROTOTYPE FORMAT AND REQUIREMENTS

Software prototyping is the activity of creating prototypes of software applications, i.e., incomplete versions of the software program being developed. It is an activity that can occur in software development and is comparable to prototyping as known from other fields, such as mechanical engineering or manufacturing. A prototype typically simulates only a few aspects of, and may be completely different from, the final product. Prototyping has several benefits: the software designer and implementer can get valuable feedback from the users early in the project. The client and the contractor can compare if the software made matches the software specification, according to which the software program is built. It also allows the software engineer some insight into the accuracy of initial project estimates and whether the deadlines and milestones proposed can be successfully met. The degree of completeness and the techniques used in prototyping have been in development and debate since its proposal in the early 1970s

. The purpose of a prototype is to allow users of the software to evaluate developers' proposals for the design of the eventual product by actually trying them out, rather than having to interpret and evaluate the design based on descriptions. Software prototyping provides an understanding of the software's functions and potential threats or issues.[1] Prototyping can also

Property of Norzagaray College OOP Object-Oriented Programming

POPULAR SOFTWARE PROTOTYPING TOOLS:

Below are some of the popular Software Prototyping Tools

  1. Balsamiq Mockups Balsamiq offers Mockups, a desktop app, and MyBalsamiq, a browser-based app, for prototyping. For this review, we have tested the desktop app. It has everything you need for putting together a quick prototype: icons, stencils, page elements such as frames and buttons, a Lorem Ipsum generator, and other elements. The Sketch vs Wireframe toggle lets you switch between the two basic skins (the drawing-like skin and the skin that looks more like a real interface). One important note: Balsamiq creators leave out the interactivity component on purpose. The idea is to help you focus on prototyping and decide on actual design later. Balsamiq is great for quick prototyping when you’re pressed for time and just want to put something together fast.
  2. Proto.io Proto is a design tool that seems to be geared towards producing mobile interfaces and animated prototypes. Inside, you've got the Sketch-esque infinite canvas, interface elements by platform (for example, iOS 9), a Lorem Ipsum text generator, and other useful resources. Everything works by layers in Proto; you can move layers up and down and group elements as needed. You can also bulk-edit element properties. I really liked the "containers" feature that lets you create a template - say, a typical Copy-Paste-Delete menu - and reuse it for future designs. The overall impression I got from Proto: their animation capabilities seem profound and interactivity appears to be a key advantage. At the same time, it may be a bit too complex if all you want is a quick prototype.
  3. Moqups Moqups is a well-balanced piece of software that lets you quickly create interactive prototypes. Like most prototyping tools, Moqups comes with a collection of stencils and icons. Their assortment of stencils is well thought-out and covers the most obvious use cases. The icons collection is impressive, as well - you can choose from Material Design, Material Design+, Font Awesome, Hawcons, Hawcons (Filled), Entypo+, and other collections. You've got interactivity options such as go to a link or a project page, toggle item visibility, or jump to an element. Nothing crazy, but they are quite useful considering that Moqups is pretty easy to use. There is also element grouping and assisted alignment.
  4. UXPin Right away, UXPin welcomes you with a collaboration board where you can see other team members' actions, comments, contributions, etc. You can also create documentation for your product and update it as you go. The prototyping board looks like the infinite canvas in Sketch, but it has one improvement: its background changes depending on whether you are in the + zone or the - zone from zero.
  5. Axure Axure lets you create fully-functional prototypes for websites and apps "without coding." For every element (such as a shape, an icon, or a text entry) you get a large variety of settings, which lets you configure it to your liking. I was able to use Axure to create a page prototype that was very similar to the original Bootique.io page. There are many interaction settings. You can add interactions on click, on swipe, on double-click, on tap, etc. Additional interaction settings become available if you click "Add Case." For example, you can redirect users to an external web page and trigger other changes to the interface. You can also add complex logic-driven animation, such as filtering a table by a parameter.
  6. Pidoco #marketing #ideation #fast #unconventional #interactive Pidoco takes a fresh and unorthodox approach to various aspects of prototyping. It offers an original collection of stencils (including a map, a slider, and a ratings stencil) and some rare interactivity triggers such as the pinch (you can also specify the number of fingers involved). It's easy to add interactions to an element, and somehow it's very explicit - in other apps, you can accidentally add an interaction to the wrong element, but that’s barely possible in Pidoco. For stencils, you've got two types of elements: building blocks and complex templates. Complex templates consist of building blocks that are frequently used together (e.g. name+password+button in a signup form).

Property of Norzagaray College OOP Object-Oriented Programming One of Pidoco's strength is that it makes it easy for you to test-drive your prototype on various screens (desktop, mobile, smartphone) and to share a responsive prototype without the need to install or upload any code. I would conclude that, although Pidoco has a limited selection of icons and colors, it's really great for quick, focused prototyping and ideation.

  1. Pencil If you're not sure whether you wish to invest into a prototyping tool, you can get Pencil, a piece of open-source software that you can use for free. While I found Pencil to be slightly buggy, it did a decent job of creating a replica of my page, and the result is quite close to the original. The only drawback is that the prototype lacks interactivity and collaboration options. Element choice-wise, Pencil offers a browser where you can look for user-contributed icon collections, browse openclipart.org clipart, and look for additional stencils. You can also generate your own stencils from images or add your own fonts. There is also a diagram drawing tool for creating diagrams. In general, I found Pencil to be quite user-friendly, albeit a bit chaotic in structure. But eventually, you should find many nice features in it, and more are available through integrations.

POST-ASSESSMENT 15 NAME: ________________________________ COURSE & SECTION: _____ SCORE: ____ Answer the following questions. Use yellow paper for your answers. 20 pts. each.

  1. Considering you are developing an E-commerce similar to Lazada, how would you create the prototype? Explain step by step.
  2. What is JNode? What are the common applications that uses this? Enumerate those apps and describe.