Computer Site Ins. INDEPENDENT STUDY GUIDE Subject No. Inc ...

44
Page 1 of 44 Computer Site Ins. Inc. INDEPENDENT STUDY GUIDE (ISG) Subject No. Programming – Java 1 1 Name Grade/Section Score / Teacher: Miss Kaye Lopez Date Content Standard/Topic: Computer Programming Basics Objectives – At the end of this ISG, I will learn to 1. Identify what is a computer program. 2. Define computer programming terminologies. 3. Describe how a program written in human language is converted into a computer program using programming language. 4. Explain how a software or program is developed. Introduction When we say computer program, it is defined as a collection of instructions that can be executed by a computer to perform a specific task. Having said that then we will say: the act of writing computer programs is called computer programming. In order to be able to write a computer program, one must use a Programming Language. A programming language is an artificial language consisting of a fixed vocabulary and a set of rules (or what we call syntax). Studying computer programming is also like studying a human language such as English, Filipino, Niponggo, Spanish and other language. Studying English is learning their vocabulary or words and also the grammar in order to be able to construct a sentence. Same with programming language, you will need to learn their vocabulary (words) or what we call in programming “commands”. Be familiar with the syntax, rules that we follow to construct a command line, same like English grammar. Once we learn how to construct a command line, then we can now give instructions to our computer to perform that task that we want the computer to perform. There are hundreds of programming languages, which can be used to write computer programs and the following are a few of them − Java; C; C++; Python; PHP; Perl; Ruby Today computer programs are being used in almost every field, household, agriculture, medical, entertainment, defense, communication, etc. Listed are a few applications of computer programs −MS Word, MS Excel, Adobe Photoshop, Internet Explorer, Chrome, etc., are examples of computer programs. Computer programs are being used to develop graphics and special effects in movie making. Computer programs are being used to perform Ultrasounds, X-Rays, and other medical examinations. Computer programs are being used in our mobile phones for SMS, Chat, and voice communication. Someone who can write computer programs or in other words, someone who can do computer programming is called a Computer Programmer. Based on computer programming language expertise, we can name a computer programmers as follows − C Programmer; C++ Programmer; Java Programmer and others. Discussion Computer Programming – Overview Before getting into computer programming, let us first understand computer programs and what they do. A computer program is a sequence of instructions written using a Computer Programming Language to perform a specified task by the computer. The two important terms that we have used in the above definition are − Sequence of instructions Computer Programming Language

Transcript of Computer Site Ins. INDEPENDENT STUDY GUIDE Subject No. Inc ...

Page 1 of 44

Computer Site Ins.

Inc.

INDEPENDENT STUDY GUIDE

(ISG)

Subject No.

Programming – Java 1 1

Name Grade/Section Score

/ Teacher: Miss Kaye Lopez Date

Content Standard/Topic: Computer Programming Basics

Objectives – At the end of this ISG, I will learn to

1. Identify what is a computer program.

2. Define computer programming terminologies.

3. Describe how a program written in human language is converted into a computer program using programming language.

4. Explain how a software or program is developed.

Introduction When we say computer program, it is defined as a collection of instructions that can be executed by a computer to perform a specific task. Having said that then we will say: the act of writing computer programs is called computer programming. In order to be able to write a computer program, one must use a Programming Language. A programming language is an artificial language consisting of a fixed vocabulary and a set of rules (or what we call syntax). Studying computer programming is also like studying a human language such as English, Filipino, Niponggo, Spanish and other language. Studying English is learning their vocabulary or words and also the grammar in order to be able to construct a sentence. Same with programming language, you will need to learn their vocabulary (words) or what we call in programming “commands”. Be familiar with the syntax, rules that we follow to construct a command line, same like English grammar. Once we learn how to construct a command line, then we can now give instructions to our computer to perform that task that we want the computer to perform. There are hundreds of programming languages, which can be used to write computer programs and the following are a few of them − Java; C; C++; Python; PHP; Perl; Ruby

Today computer programs are being used in almost every field, household, agriculture, medical, entertainment, defense, communication, etc. Listed are a few applications of computer programs −MS Word, MS Excel, Adobe Photoshop, Internet Explorer, Chrome, etc., are examples of computer programs.

Computer programs are being used to develop graphics and special effects in movie making.

Computer programs are being used to perform Ultrasounds, X-Rays, and other medical examinations.

Computer programs are being used in our mobile phones for SMS, Chat, and voice communication. Someone who can write computer programs or in other words, someone who can do computer programming is called a Computer Programmer. Based on computer programming language expertise, we can name a computer programmers as follows −

C Programmer; C++ Programmer; Java Programmer and others.

Discussion Computer Programming – Overview Before getting into computer programming, let us first understand computer programs and what they do. A computer program is a sequence of instructions written using a Computer Programming Language to perform a specified task by the computer. The two important terms that we have used in the above definition are −

Sequence of instructions

Computer Programming Language

Page 2 of 44

To understand these terms, consider a situation when someone asks you about how to go to a nearby KFC. What exactly do you do to tell him the way to go to KFC? You will use Human Language to tell the way to go to KFC, something as follows −

First go straight, after half kilometer, take left from the red light and then drive around one kilometer and you will find KFC at the right.

Here, you have used English Language to give several steps to be taken to reach KFC. If they are followed in the following sequence, then you will reach KFC –

1. Go straight 2. Drive half kilometer 3. Take left 4. Drive around one kilometer 5. Search for KFC at your right side

Now, try to map the situation with a computer program. The above sequence of instructions is actually a Human Program written in English Language, which instructs on how to reach KFC from a given starting point. This same sequence could have been given in Spanish, Hindi, Arabic, or any other human language, provided the person seeking direction knows any of these languages. Now, let's go back and try to understand a computer program, which is a sequence of instructions written in a Computer Language to perform a specified task by the computer. Following is a simple program written in Java programming Language −

System.out.println (“Hello, World!”); The above computer program instructs the computer to print "Hello, World!" on the computer screen.

A computer program is also called a computer software, which can range from two lines to millions of lines of instructions.

Computer program instructions are also called program source code and computer programming is also called program coding. A computer without a computer program is just a dump box; it is programs that make computers active. SOFTWARE DEVELOPMENT PROCESS High-lelvel programming languages help programmers write high-quality software in much the same sense as good tools help carpenters build high-quality houses, but there is much more to programming than writing lines of code, just as thre is more to building houses than pounding nails. The more consists of organization and planning and various diagrammatic conventions for expressing those plans. To this end, computer scientists have developed a view of the software development process known as the software development life cycle. We now present a particular version of this life cycle, called the waterfall model. The waterfall model consists of several phases:

1. Customer request – In this phase, the programmers receive a broad statement of a problem that is potentially amenable to a computerized solution. This step is also called the user requirements phase.

2. Analysis – The programmers determine what the program will do. This is sometimes viewed as a process of clarifying the specification for the problem. With in this phase, programmers must be very meticulous when it comes to details. Because one small tiny detail can destroy the entire design of the program.

3. Design – The programmers determine how the program will do its task. 4. Implementation – The programmers write the program. This step is also called the coding phase. 5. Integration – Large programs have many parts. In the integration phase, these parts are brought together into a

smoothly functioning whole, usually not an easy task. 6. Maintenance – Programs usually have a long life; 5 to 15 years are common. During this time, requirements change and

minor or major modifications must be made.

The interaction between the phases is shown below. Note that the figure resembles a waterfall, in which the results of each phase flow down to the next. A mistake detected in one phase often requires the developer to back up and redo some of the work in the previous phase. Modifications made during maintenance also require backing up to earlier phases.

Page 3 of 44

Programs rarely work as hoped the first time they are run; hence, they should be subjected to extensive and careful testing. Many people think that testing is an activity that applies to only the implementation and integration phases; however, the outputs of each phase should be scrutinized carefully. In fact, mistakes found early are musch less expensive to correct than those found late.

Self-Test Questions Instructions: Study each questions carefully and answer each questions in paragraph form and in Filipino language. Write your answers in a separate sheet of long bond paper. And it should be handwritten. Write your name, grade and section in the upper left part of the front side of the bond paper. Insert it in a long brown envelop and have it submitted in the drop box located in the lobby of the school.

1. What happens during the analysis and design phases of the software development process? 2. How does the waterfall model of software development work? 3. In your own words, define computer program, computer programming and programming language.

Rubrics for Essay

Focus (The single controlling point made with an awareness of task about a specific topic) - 5 pts Content (The presence of ideas developed through facts, examples, details, opinions, Reasons and/or explanations) - 5 pts Conventions (Grammar, spelling, usage and sentence formation and neatness) - 5 pts Total Score - 15 pts per item

Student’s Insights

References

Tutorials Point; Computer Programming; USA, 2014 https://www.tutorialspoint.com/computer_programming/computer_programming_overview.htm

Wikipedia; Computer Program; USA, 2020 https://en.wikipedia.org/wiki/Computer_program,

Java: A Framework for Programming and Problem Solving; Kenneth Lambert and Martin Osborne; Singapore, 2002

Page 4 of 44

Teacher’s Remarks: ______ Complete ______ Incomplete ______ Redo ______ For Consultation

Page 5 of 44

Computer Site Ins.

Inc.

INDEPENDENT STUDY GUIDE

(ISG)

Subject No.

Programming – Java 1 2

Name Grade/Section Score / Teacher: Miss Kaye Lopez Date

Content Standard/Topic: PROGRAM DESIGN TOOLS - ALGORITHM

Objectives – At the end of this ISG, I will learn to

1. Explain the data processing steps. 2. Define what is an algorithm. 3. Use algorithm to describe the steps needed to complete a task.

Introduction Program Design Tools or also known as the Programming tools, are tools used to develop a program. During designing a program (third phase of the Software Development Process – see ISG-1-Programming-Java1-11-1 page 2) different tools are required to solve several problems. Some of the frequently used tools are: algorithm, flowchart and pseudocode. Before we proceed to discuss the Program Design Tools. It is highly important that we understand the data processing steps in order for the programmer to create an effective design for their programs. Data processing steps shows how data is transferred from one device to another and how you can manipulate data.

Discussion DATA PROCESSING STEPS Data processing occurs when data is collected and translated into usable information. It is important for data processing to be done correctly as not to negatively affect the end product, or data output. Data processing starts with data in its raw form and converts it into a more readable format (graphs, documents, etc.), giving it the form and context necessary to be interpreted by computers and utilized by the end users. Input – This is the stage where in user is feeding the data to the system unit. Data input is the first stage in which raw data begins to take the form of usable information. Devices normally used in inputting are keyboards, mouse, scanners, webcam, microphone, biometrics (scanners used to scan the human body) and others. Process – This is the stage where in data is manipulated into a more useful form. During this stage, the data inputted to the computer in the previous stage is actually processed for interpretation. Process usually takes place in the system unit and to be specific in the central processing unit or CPU. During this step, the different data processing operations take place. Examples of data processing operations are: computing, merging, feedback, storing of data, retrieving of data, sorting, classifying and verifying Output – This stage shows the results. The output/interpretation stage is the stage at which data is finally usable to the users. It is translated, readable, and often in the form of graphs, videos, images, plain text, etc.). Devices commonly used to output data are monitors, speakers, headphone, projectors and printers. ALGORITHM An algorithm is a sequence of instructions or step by step instructions to find the solution of a problem. An algorithm should be simple and clear. It must be to the point and should lead to the solution of the program in a finite number of steps. An algorithm is composed of a finite set of steps, each of which may require one or more operations. Each operation must be definite, effective and finite. The steps in the algorithm that we are referring to are the data processing steps. Each step could be an input, a process or an output. Writing an Algorithm

Output Input Process

Page 6 of 44

A perfect example of an algorithm is a recipe. The procedures in a recipe shows how you can cook a certain recipe. Each steps shows the operation needed to perform in able to complete the dish. This is what we call an algorithm. In writing an algorithm, grammatically speaking, there is no right or wrong. You may use a phrase of a complete sentence. Granting that you can express what you wish to do or perform in a step. We can tell that an algorithm is correct, is if when we perform the steps from step 1 to the last step and we come up giving solution to the problem. That is the time that we can tell if the algorithm is correct or not. Algorithm is all about the logical sequence. When we say logical sequence, it refers to any order of events or things that makes sense. For example, my task is to cook pork adobo. The logical sequence would be cut the pork, cook and serve. An incorrect sequence could be: (a) cook, serve and cut the pork or (b) serve, cook and cut pork. Sequence should be in order and proper. Example of algorithm Task: Adding two numbers Step 1: Input number1 and number2 Step 2: Compute: answer = number1 + number2 Step 3: Print answer Task: Compute Semestral Grade Step 1: input grades for prelim, midterm, prefinals, finals Step 2: Compute: sum = prelim + midterm + prefinals + finals Step 3: Compute: average = sum / 4 Step 4: Print average Step 5: Show Grades Remarks If average >=75 Print “Passed” Else Print “Failed”

Self-Test Questions Instructions: Study each questions carefully and answer each questions in paragraph form and in Filipino language. Write your answers in a separate sheet of long bond paper. And it should be handwritten. Write your name, grade and section in the upper left part of the front side of the bond paper. Insert it in a long brown envelop and have it submitted in the drop box located in the lobby of the school.

1. Explain the data processing steps? 2. In your own words, what is a program design tools and what are its applications? 3. What is an algorithm?

Rubrics for Essay Focus (The single controlling point made with an awareness of task about a specific topic) - 5 pts Content (The presence of ideas developed through facts, examples, details, opinions, Reasons and/or explanations) - 5 pts Conventions (Grammar, spelling, usage and sentence formation and neatness) - 5 pts Total Score - 15 pts per item

Student’s Insights

References

Talend; What is Data Processing; USA, 2020 https://www.talend.com/resources/what-is-data-processing/

Kullabs; Program Design Tools; Nepal, 2019 https://www.kullabs.com/classes/subjects/units/lessons/notes/note-detail/4093

Concept of Computer Fundamentals; Copernicus Pepito; Philippines, 2015

Teacher’s Remarks: ______ Complete ______ Incomplete ______ Redo ______ For Consultation

Page 7 of 44

Computer Site Ins.

Inc.

INDEPENDENT STUDY GUIDE

(ISG)

Subject No.

Programming – Java 1 3

Name Grade/Section Score / Teacher: Miss Kaye Lopez Date

Content Standard/Topic: PROGRAM DESIGN TOOLS - FLOWCHART

Objectives – At the end of this ISG, I will learn to

1. Define what is a variable. 2. Use a variable to store data. 3. Define what is a flowchart. 4. Identify the different symbols used in flowchart 5. Use flowchart to illustrate the steps needed to complete a task.

Introduction Program Design Tools or also known as the Programming tools, are tools used to develop a program. During designing a program (third phase of the Software Development Process – see ISG-1-Programming-Java1-11-1 page 2) different tools are required to solve several problems. Some of the frequently used tools are: algorithm, flowchart and pseudocode.

Discussion VARIABLE Variables are used to store information to be referenced and manipulated in a computer program. They also provide a way of labeling data with a descriptive name, so our programs can be understood more clearly by the reader and ourselves. It is helpful to think of variables as containers that hold information. Their sole purpose is to label and store data in memory. This data can then be used throughout your program. ASSIGNING VALUE TO VARIABLES Naming variables is known as one of the most difficult tasks in computer programming. When you are naming variables, think hard about the names. Try your best to make sure that the name you assign your variable is accurately descriptive and understandable to another reader. Sometimes that other reader is yourself when you revisit a program that you wrote months or even years earlier. When you assign a variable, you use the = symbol. The name of the variable goes on the left and the value you want to store in the variable goes on the right. Ex. Name=”Kaye” Age = 15 FLOWCHART A flowchart is a type of diagram that represents a workflow or process. A flowchart can also be defined as a diagrammatic representation of an algorithm, a step-by-step approach to solving a task. The flowchart shows the steps as boxes of various kinds, and their order by connecting the boxes with arrows. This diagrammatic representation illustrates a solution model to a given problem. Flowcharts are used in analyzing, designing, documenting or managing a process or program in various fields. SYMBOLS

Name Shape Function

Terminal Symbol (Start/End) Oblong

It marks the beginning and end of the flowchart

Preparation Symbol Hexagon

Represents a set up to another step in the process. Also used to declare and assign value to a variable

Input/Output Symbol

Parallelogram Represents an instruction to an input or output devices. (See Data Processing Step - ISG-1-ProgrammingJava1-11-2 page 1)

Process Symbol Rectangle Represents a process or a group of program commands

Page 8 of 44

Decision Symbol Diamond Indicates a decision. This symbol shows more than one path can be taken. Inside the symbol should be a condition or question answerable by true or false or Yes or No.

On Page Connector Small Circle Indicates that the flow continues where a matching symbol (containing the same letter) has been placed.

Off Page Connector Small Pentagon

Indicates that the process continues off page.

BEST PRACTICES IN CREATING A FLOWCHART While learning the various symbols that are associated with flowcharts are rather important, you need to also remember that there are certain guidelines in flowcharting that deserves some respect as well. The following are some guidelines in flowcharting: 1. Proper Form is Essential: In drawing a proper flowchart, all necessary requirements should be listed out in a logical order. 2. Clarity is Paramount: The flowchart should be clear, neat and easy to follow. There should not be any room for ambiguity in understanding the flowchart. 3. Stick to the Right Direction: The usual direction of the flow of a procedure or system is from left to right or top to bottom. 4. The standard for Flow Lines: Ideally just one flow line should come out from a process symbol. While only one flow line should enter a decision symbol, around three flow lines (depending on the answer) should leave the decision symbol. Additionally, only one flow line is utilized together with a terminal symbol. 5. Be Concise, not Copious: Write within standard symbols briefly. 6. Logic precedes Everything: If you are dealing with a complex flowchart then use connector symbols to minimize the number of flow lines. Ditch the intersection of flow lines to ensure effectiveness and better communication. It is imperative that your flowchart has a logical start and finish.

Example of Algorithm Example of Flowchart

Task: Adding two numbers All variables used are declared first in the preparation symbol or hexagon Step 1: Input number1 and number2 Represented by the input/output symbol or parallelogram Step 2: Compute: answer = number1 + number2 Represented by the process symbol or rectangle Step 3: Print answer Represented by the input/output symbol or parallelogram

Task: Compute Semestral Grade All variables used are declared first in the preparation symbol or hexagon Step 1: input grades for prelim, midterm, prefinals, finals Represented by the input/output symbol or parallelogram

Start

N1=0;

n2=0;ans=0

Input n1, n2

Ans=n1+n2

Output ans

End

A Start

Pre=0; mid=0; pf=0,

fin=0;sum=0;

average=0

Input pre, mid,

pf, fin

Sum = pre+mid+pf+fin

Average = sum /4

A

Page 9 of 44

Computer Site Ins.

Inc.

Step 2: Compute: sum = prelim + midterm + prefinals + finals Represented by the process symbol or rectangle Step 3: Compute: average = sum / 4 Represented by the process symbol or rectangle Step 4: Print average Represented by the input/output symbol or parallelogram Step 5: Show Grades Remarks If average >=75 Print “Passed” Else Print “Failed”

Self-Test Questions Instructions: Study each questions carefully and answer each questions in paragraph form and in Filipino language. Write your answers in a separate sheet of long bond paper. And it should be handwritten. Write your name, grade and section in the upper left part of the front side of the bond paper. Insert it in a long brown envelop and have it submitted in the drop box located in the lobby of the school.

1. Explain what is a variable in computer programming and what is it used for? 2. What is a flowchart? 3. Can you use a flowchart in your everyday life?

Rubrics for Essay Focus (The single controlling point made with an awareness of task about a specific topic) - 5 pts Content (The presence of ideas developed through facts, examples, details, opinions, Reasons and/or explanations) - 5 pts Conventions (Grammar, spelling, usage and sentence formation and neatness) - 5 pts Total Score - 15 pts per item

Student’s Insights

References

LaunchSchool; Variables; https://launchschool.com/books/ruby/read/variables

Wikipedia; Flowchart; USA, 2020 https://en.wikipedia.org/wiki/Flowchart

SmartDraw; Flowchart Symbols; USA, 2020 https://www.smartdraw.com/flowchart/flowchart-symbols.htm

Concept of Computer Fundamentals; Copernicus Pepito; Philippines, 2015

Teacher’s Remarks: ______ Complete ______ Incomplete ______ Redo ______ For Consultation

INDEPENDENT STUDY GUIDE

(ISG)

Subject No.

Programming – Java 1 4

Represented by decision

or diamond symbol

Represented by the input/output symbol or

parallelogram

Page 10 of 44

Name Grade/Section Score / Teacher: Miss Kaye Lopez Date

Content Standard/Topic: JAVA PROGRAMMING - INTRODUCTION

Objectives – At the end of this ISG, I will learn to

1. Describe java programming language. 2. Recognize the role of Java Virtual Machine and Byte Code in Java Programming. 3. Explain what is an IDE and Netbeans.

Introduction Java is a general-purpose programming language that is class-based, object-oriented, and designed to have as few implementation dependencies as possible. It is intended to let application developers write once, run anywhere (WORA), meaning that compiled Java code can run on all platforms that support Java without the need for recompilation. Java was originally developed by James Gosling at Sun Microsystems (which has since been acquired by Oracle) and released in 1995 as a core component of Sun Microsystems' Java platform.

Discussion JAVA LANGUAGE Java is the fastest growing programming language in the world. Companies such as IBM and Sun have adopted Java as their major application development language. There are several reasons for this. First, Java is a modern object-oriented pramming language. The designers of Java spent much time studying the features of classical object-oriented language such as Smalltalk and C++ andmade a successful effort to incorporate the good features of these languages and omit the less desirable one. Second, Java is secure, robust and portable. That is, the Java Language

Enables the construction of virus-free, tamper-free systems (secure)

Supports the development of programs that do not overwrite memory (robust) Yields programs that can be run on different types of computers without changes (portable)

Third, Java supports the use of advanced programming concepts such as threads. A thread is a process that ca run concurrently with other processes. For example, a single Java application might consist of two threads. One thread transfers an mage from one machine to another acreoss a network, while the other thread simultaneously interacts with the user. Fourth, Java bears asuperficial resemblance to C++, which is currently the world’s most popular industrial strength programming language. Thus, it is easy for a C++ programmer to learn Java and for a Java programmer to learn C++. However, compared to C++, Java is easier to use and learn, less error prone, more portable and better suited to the Internet.. On the negative side, Java runs more slowly than most modern programming languages because it is interpreted JAVA VIRTUAL MACHINE AND BYTE CODE Compilers usually translate a higher-level language into the machine language of a particular type of computer. However, the Java compiler translates Java not into machine language, but into a pseudomachine language called Java Byte Code. Byte code is the machine language for an imaginary Java computer. To run Java byte code on a particular computer, you must install a Java Virtual Machine (JVM) on that computer. A JVM is a program that behaves like a computer. Such a program is called an interpreter. An interpreter has several advantages and disadvantages. The main disadvantage of an interpreter is that a program pretending to be a computer runs programs more slowly than an actual computer. The main advantage of an interpreter is that any computer can run it. Thus, Java byte code is highly portable. The JVM has two primary functions: to allow Java programs to run on any device or operating system (known as the "Write once, run anywhere" principle), and to manage and optimize program memory. When Java was released in 1995, all computer programs were written to a specific operating system, and program memory was managed by the software developer. So the JVM was a revelation. Having a technical definition for the JVM is useful, and there's also an everyday way that software developers think about it. Let's break those

Page 11 of 44

down:

Technical definition: The JVM is the specification for a software program that executes code and provides the runtime environment for that code.

Everyday definition: The JVM is how we run our Java programs. We configure the JVM's settings and then rely on it to manage program resources during execution.

1 View of how JVM applies JAVA IDE (INTEGRATED DEVELOPMENT ENVIRONMENT) An integrated development environment (IDE) is a software application that provides comprehensive facilities to computer programmers for software development. An IDE normally consists of at least a source code editor, build automation tools and a debugger. A popular IDE for Java Language is the Netbeans. NetBeans is an integrated development environment (IDE) for Java. NetBeans allows applications to be developed from a set of modular software components called modules. NetBeans runs on Windows, macOS, Linux and Solaris. In addition to Java development, it has extensions for other languages like PHP, C, C++, HTML5 and JavaScript. To download netbeans: https://netbeans.org

Self-Test Questions Instructions: Study each questions carefully and answer each questions in paragraph form and in Filipino language. Write your answers in a separate sheet of long bond paper. And it should be handwritten. Write your name, grade and section in the upper left part of the front side of the bond paper. Insert it in a long brown envelop and have it submitted in the drop box located in the lobby of the school.

1. What does JVM stand for? 2. What is byte code? Describe how the JVM uses byte code. 3. What is a portable program?

Rubrics for Essay Focus (The single controlling point made with an awareness of task about a specific topic) - 5 pts Content (The presence of ideas developed through facts, examples, details, opinions, Reasons and/or explanations) - 5 pts Conventions (Grammar, spelling, usage and sentence formation and neatness) - 5 pts Total Score - 15 pts per item

Student’s Insights

Page 12 of 44

References

Java World; What is the JVM? Introducing the Java Virtual Machine; USA, 2020 https://www.javaworld.com/article/3272244/what-is-the-jvm-introducing-the-java-virtual-machine.html

Wikipedia; Java (Programming Language); USA, 2020 https://en.wikipedia.org/wiki/Java_(programming_language)

Wikipedia; Integrated Development Environment; USA, 2020 https://en.wikipedia.org/wiki/Integrated_development_environment

Java: A Framework for Programming and Problem Solving; Kenneth Lambert and Martin Osborne;Singapore, 2002

Teacher’s Remarks: ______ Complete ______ Incomplete ______ Redo ______ For Consultation

Page 13 of 44

Computer Site Ins.

Inc.

INDEPENDENT STUDY GUIDE

(ISG)

Subject No.

Programming – Java 1 5

Name Grade/Section Score / Teacher: Miss Kaye Lopez Date

Content Standard/Topic: DISPLAYING OUTPUT

Objectives – At the end of this ISG, I will learn to

1. Identify what is JDK. 2. Use the Netbeans to create programs. 3. Install JDK and NetBeans to my computer. 4. Use java commands to create an output or display in the console.

Introduction NetBeans is an integrated development environment for Java. NetBeans allows applications to be developed from a set of modular software components called modules. NetBeans runs on Windows, macOS, Linux and Solaris.

Discussion JAVA DEVELOPMENT KIT The Java Development Kit (JDK) is one of three core technology packages used in Java programming, along with the JVM (Java Virtual Machine) and the JRE (Java Runtime Environment). It's important to differentiate between these three technologies, as well as understanding how they're connected:

The JVM is the Java platform component that executes programs.

The JRE is the on-disk part of Java that creates the JVM.

The JDK allows developers to create Java programs that can be executed and run by the JVM and JRE. Developers new to Java often confuse the Java Development Kit and the Java Runtime Environment. The distinction is that the JDK is a package of tools for developing Java-based software, whereas the JRE is a package of tools for running Java code. The JRE can be used as a standalone component to simply run Java programs, but it's also part of the JDK. The JDK requires a JRE because running Java programs is part of developing them.

How To Install JDK on Windows Step 1: Download JDK Goto Java SE download site @ http://www.oracle.com/technetwork/java/javase/downloads/index.html. Under "Java Platform, Standard Edition" ⇒ "Java SE 13.0.{x}", where {x} denotes a fast running security-update number ⇒ Click the "Oracle JDK Download" button. Under "Java SE Development Kit 13.0.{x}" ⇒ Check "Accept License Agreement". Choose the JDK for your operating system, i.e., "Windows". Download the "exe" installer (e.g., "jdk-13.0.{x}_windows-x64_bin.exe" - about 159MB). Step 2: Install JDK Run the downloaded installer (e.g., "jdk-13.0.{x}_windows-x64_bin.exe"), which installs both the JDK and JRE.

Page 14 of 44

By default, JDK is installed in directory "C:\Program Files\Java\jdk-13.0.{x}", where {x} denotes the update number. Accept the defaults and follow the screen instructions to install JDK. Use your "File Explorer", navigate to "C:\Program Files\Java" to inspect the sub-directories. Take note of your JDK installed directory jdk-13.0.{x}, in particular, the update number {x}, which you will need in the next step. Starting the Download FOR NETBEANS

1. Go to https://netbeans.org/downloads/. 2. In the upper right area of the page, select the language and platform from the drop-down list. You can also choose to download and

use the platform-independent zip file. 3. Click the Download button for the download option that you want to install. 4. Save the installer file to your system.

Installing the Software Follow the instructions in this section to install the IDE on your system. These installation instructions apply to all supported platforms. For the list of supported platforms and system requirements, see the release notes. Microsoft Windows

1. After the download completes, run the installer. Double-click the installer file to run it. 2. If you downloaded the All or Java EE bundle, you can customize your installation. Perform the following steps at the Welcome page

of the installation wizard: 3. Click Customize. 4. In the Customize Installation dialog box, make your selections. 5. Click OK. 6. At the Welcome page of the installation wizard, click Next. 7. At the License agreement page, review the license agreement, click the acceptance check box, and click Next. 8. Click Next. 9. Click Install to begin the installation. 10. At the Setup Complete page, provide anonymous usage data if desired, and click Finish.

Setting Up the Project To create an IDE project:

1. Start NetBeans IDE. 2. In the IDE, choose File > New Project, as shown in the figure below.

3. In the New Project wizard, expand the Java category and select Java Application as shown in the figure below. Then click Next.

Page 15 of 44

4. In the Name and Location page of the wizard, do the following (as shown in the figure below):

In the Project Name field, type HelloWorldApp. (You can change the Project name ‘HelloWorldApp” with an appropriate name for your program or project)

Leave the Use Dedicated Folder for Storing Libraries checkbox unselected.

In the Create Main Class field, type helloworldapp.HelloWorldApp.

5. Click Finish. The project is created and opened in the IDE. You should see the following components:

The Projects window, which contains a tree view of the components of the project, including source files, libraries that your code depends on, and so on.

The Source Editor window with a file called HelloWorldApp open.

The Navigator window, which you can use to quickly navigate between elements within the selected class.

Page 16 of 44

DEFAULT PROGRAM CODES These are the codes that are already in the source code editor everytime you create a new program. Source Code - text listing of commands to be compiled or assembled into an executable computer program. These are the actual codes.

Line Source Code Explanation

1 2 3 4 5

/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */

This is a comment. A comment is a programmer-readable explanation or annotation in the source code of a computer program. Multiline comment is contained with in the codes /* and */

6 package helloworldapp; This is the progam package, think of it as a folder in a file directory. Never edit this part.

7 8 9 10 11

/* * * @author KayeLopez */

Another example of multiline comment. Ang comment ay hindi binabasa ng computer, ito ay para sa programmer lamang

12 public class HelloWorldApp { This line will create the whole program. This is the start of the class, it was connotated by the Open curly bracket ({). The class starts from line 12 to line 21.

13 14 15 16

/* * @param args the command line arguments */

Another example of multiline comment Pwedeng burahin ang comments

17 public static void main(String[] args) { Beginning of the main function, this is the first one to execute when you run the program. Main function is connotated by the open curly bracket ({). The main function starts from line 17 to line 19.

18 // TODO code application logic here Single line comment, you start the line with // Sa part na ito, dito tayo nagtatype ng program codes natin.

19 } Close curly bracket (}) partner ng line 17

20

21 } Close curly bracket (}) partner ng line 12

22

** Please take note that the line numbers changes as you add more command lines in the program. TO EXECUTE A PROGRAM There are several ways to execute a program. 1. Press the F6 key. 2. Go to menu bar > Run >Run Project

3. Press the Run Project icon TO DISPLAY AN OUTPUT IN YOUR PROGRAM Java System.out.println() is used to print an argument that is passed to it. The statement can be broken into 3 parts which can be understood separately as: 1. System: It is a final class defined in the java.lang package. 2. out: This is an instance of PrintStream type, which is a public and static member field of the System class. 3. println(): As all instances of PrintStream class have a public method println(), hence we can invoke the same on out as well. This is an

upgraded version of print(). It prints any argument passed to it and adds a new line to the output. We can assume that System.out represents the Standard Output Stream.

Page 17 of 44

Line Source Code Explanation

1 package helloworldapp; (“Hello World”) Anything that you type between the “ “ will be displayed as is. This works for Strings. String are combination of 2 or more characters

2 public class HelloWorldApp { 3 public static void main(String[] args) {

4 System.out.println("Hello World");

5 }

6 }

Output Hello World BUILD SUCCESSFUL (total time: 0 seconds)

Line Source Code Explanation

1 package helloworldapp; (“Hello World”) Anything that you type between the “ “ will be displayed as is. This works for Strings. String are combination of 2 or more characters

2 public class HelloWorldApp {

3 public static void main(String[] args) {

4 System.out.println("Hello World");

5 System.out.println("Welcome to Computer Site Ins.");

6 System.out.println("This is Programming - Java1");

7 System.out.println("Let's begin");

8 } 9 }

Output Hello World Welcome to Computer Site Ins. This is Programming - Java1 Let's begin BUILD SUCCESSFUL (total time: 0 seconds)

TO CONCATENATE STRING Concatenation is the connection of two (2) or more characters. We use the plus symbol (+) to concatenate characters and/or strings. Example of concatenation is:

Source Code Output System.out.println(“A” + “B”); AB

System.out.println(“Com” + “site”); Comsite

System.out.println(“Welcome” + “ “ + “Students”); Welcome Students

Source Code Output

package concatenate; public class Concatenate { public static void main(String[] args) { System.out.println("A" + "B"); System.out.println("Com" + "site"); System.out.println("Welcome" + " " + "Students"); } }

run: AB Comsite Welcome Students BUILD SUCCESSFUL (total time: 0 seconds)

Self-Test Questions Instructions:

1. Choose your favorite song, whether it is foreign or OPM. 2. Using the output commands of Java Programming Language, your favorite song should be displayed. Write your codes in a long bond

paper, and it should be handwritten. 3. Write your name, grade and section in the upper left part of the front side of the bond paper. Insert it in a long brown envelop and

have it submitted in the drop box located in the lobby of the school.

Page 18 of 44

Rubrics for Programs

Criteria 5-Excellent 3-Good 2-Poor 1-Unacceptable Score

Solution Completed solution runs without errors. Meets all specifications

Completed solution is tested and runs but does not meet all the specifications and/or work for all test data.

Completed solution is implemented on the required platform. It runs, but has logical errors.

Incomplete solution is implemented on the required platform. Does not complie and/or run.

Program Design

Program design uses appropriate structures. The overall program design appropriate.

Program design generally uses appropriate structures. Program elements exhibit good design.

Not all of the selected structures are appropriate. Some of the program elements are appropriately designed.

Few of the selected structures are appropriate. Program elements are not well designed.

User Interface User interaction is as specified and is natural to the user

User interaction generally meets the specifications and is acceptable

User interaction minimally meets the specifications, but does not increase usability

User interaction is incomplete and does not meet specifications.

Total Score

Student’s Insights

References

Wikipedia; NetBeans; USA, 2020 https://en.wikipedia.org/wiki/NetBeans

NTU; Programming Notes; Singapore, 2020 https://www.ntu.edu.sg/home/ehchua/programming/howto/JDK_HowTo.html

Java World; What is the JDK? Introduction to the Java Development Kit; USA, 2020 https://www.javaworld.com/article/3296360/what-is-the-jdk-introduction-to-the-java-development-kit.html

NetBeans; NetBeans IDE 8.2 Installation Instructions; USA, 2020 https://netbeans.org/community/releases/82/install.html#install_windows

GeeksforGeeks; System.out.println in Java; India, 2020 https://www.geeksforgeeks.org/system-out-println-in-java/

Java: A Framework for Programming and Problem Solving; Kenneth Lambert and Martin Osborne;Singapore, 2002

Teacher’s Remarks: ______ Complete ______ Incomplete ______ Redo ______ For Consultation

Page 19 of 44

Computer Site Ins.

Inc.

INDEPENDENT STUDY GUIDE

(ISG)

Subject No.

Programming – Java 1 6

Name Grade/Section Score / Teacher: Miss Kaye Lopez Date

Content Standard/Topic: DATA INPUTTING

Objectives – At the end of this ISG, I will learn to

1. Use a scanner object to accept inputs. 2. Identify the different data types used in java programming. 3. Define a variable. 4. Recognize the different mathematical operations used in java programming. 5. Solve mathematical operations using java language.

Introduction Logic models are program planning tools that define the inputs, outputs, outcomes of a program in order to explain the thinking behind program design and show how specific program activities lead to desired results. Inputs include the resources, contributions, and investments that go into a program; outputs are the activities, services, events and products that reach the program’s primary audience; and outcomes are the results or changes related to the program’s intervention that are experienced by the primary audience.

Discussion VARIABLES Variables, as discussed in ISG-1-ProgrammingJava1-11-3 (Program Design Tools – Flowchart), are used to store information to be referenced and manipulated in a computer program. In its simplest definition, variable is a temporary storage of data, wherein all of your inputs and processed data are stored or placed. DATA TYPES A data type or simply type is an attribute of data which tells the compiler or interpreter how the programmer intends to use the data. Most programming languages support basic data types of integer numbers (of varying sizes), Floating-point numbers (which approximate real numbers), characters and Booleans. A data type constrains the values that an expression, such as a variable or a function, might take. This data type defines the operations that can be done on the data, the meaning of the data, and the way values of that type can be stored. Common Data Types

Data Type Data Type Code Explanation 1 String String Combination of 2 or more characters

2 Integer int Whole numbers

3 Double double Whole numbers with fractional part

4 Boolean boolean Can accept only true or false

TO DECLARE A VARIABLE Syntax: data_Type <variable_name> = value; Example: String name=””; int num1 = 0; JAVA USER INPUT (SCANNER) The Scanner class is used to get user input, and it is found in the java.util package. To use the Scanner class, create an object of the class and use any of the available methods found in the Scanner class documentation. In our example, we will use the nextLine() method, which is used to read Strings. Example #1

Line Source Code [Filename: ScanInput] Explanation

Page 20 of 44

1 package scaninput;

2 import java.util.*; A java package is a group of similar types of classes, interfaces and sub-packages. To connect a java package to a program, we follow this syntax: import java_package_name;

3 public class ScanInput {

4 public static void main(String[] args) { 5 Scanner myObj = new Scanner(System.in); Creates a Scanner Object

Scanner name = new Scanner(System.in); Name is the scanner object name. you can replace it

6 String username= “”; Variable declaration

7 System.out.println("Enter username"); Instruction to user on what they need to input

8 username = myObj.nextLine(); Reads user input We use .nextLine() method if the data type of your variable is String (see Line 6: String username=””;)

9 System.out.println("Username is: " + username); Output user input 10 } Close curly bracket of line 4

11 } Close curly bracket of line 3

Output Enter username kaye Username is: kaye BUILD SUCCESSFUL (total time: 8 seconds)

Where “kaye” is the name inputted by the user

Example #2

Line Source Code [UseScanner] Explanation

1 package usescanner;

2 import java.util.*;

3 public class UseScanner { 4 public static void main(String[] args) {

5 Scanner inputNumber = new Scanner(System.in); Use different scanner object for different data types This one is for numbers (integers and doubles)

6 Scanner inputString = new Scanner (System.in); This one is for string

7 8 9

int num1=0; double num2=0; String name="";

Variable declarations

10 System.out.print("Input First Number: "); Instruction to the user

11 num1 = inputNumber.nextInt(); Reads user input We use .nextInt() method if the data type of your variable is Integer (see Line 7: int num1=0;)

12 System.out.print("Input Second Number: "); Instruction to the user 13 num2 = inputNumber.nextDouble(); We used .nextDouble() method if the data type of the variable is

double.

14 System.out.print("Input Your name: ");

15 name = inputString.nextLine();

16 System.out.print("\n\nYour name is " + name); This is concatenation. Concatenation is connecting two or more string and objects

17 } Close curly bracket of line 4

18 } Close curly bracket of line 3

run: Input First Number: 3 Input Second Number: 7 Input Your name: kaye lopez Your name is kaye lopez BUILD SUCCESSFUL (total time: 9 seconds)

3, 7 and kaye lopez are inputs

Example #3

Page 21 of 44

Line Source Code [Filename: Add2Numbers] Explanation

1 package add2numbers;

2 import java.util.*; 3 public class Add2Numbers {

4 public static void main(String[] args) {

5 int num1=0, num2=0, ans=0;

6 Scanner input = new Scanner(System.in);

7 System.out.print("Enter First Number: ");

8 num1 = input.nextInt();

9 System.out.print("Enter First Number: "); 10 num2 = input.nextInt();

11 ans = num1 + num2; This is a formula. Left-hand part is the variable for the answer or output. The right-hand part is the formula.

12 System.out.println("The sum is " + ans);

13 }

14 }

Output run: Enter First Number: 5 Enter First Number: 6 The sum is 11 BUILD SUCCESSFUL (total time: 5 seconds)

Numbers 5 and 6 are the user inputs 11 is the result of the formula

ARITHMETIC OPERATORS USED IN JAVA LANGUAGE

Operator Use Description Example

+ x + y Adds x and y double num=23.4 + 1.6; num=25

- x – y Subtracts y from x double n = 12.456-2.456; N=10

-x Negates x Int a =5; -a; a = -5

* x * y Multiplies x by y Int m=10 * 3; m = 30

/ x / y Divides x by y double div = 20/100; div = 0.2 % x % y Computes the remaining of dividing x

by y Int rm = 20/3; rm = 2

Self-Test Questions Instructions: Study each questions carefully and answer each questions in paragraph form and in Filipino language. Write your answers in a separate sheet of long bond paper. And it should be handwritten. Write your name, grade and section in the upper left part of the front side of the bond paper. Insert it in a long brown envelop and have it submitted in the drop box located in the lobby of the school.

1. What is a variable? And how do you use a variable? 2. What is a scanner? And how do you declare a scanner object with the name ‘typemo’

Rubrics for Essay Focus (The single controlling point made with an awareness of task about a specific topic) - 5 pts Content (The presence of ideas developed through facts, examples, details, opinions, Reasons and/or explanations) - 5 pts Conventions (Grammar, spelling, usage and sentence formation and neatness) - 5 pts Total Score - 15 pts per item

Student’s Insights

Page 22 of 44

References

LaunchSchool; Variables; https://launchschool.com/books/ruby/read/variables

Wikipedia;Data Type; USA, 2020 https://en.wikipedia.org/wiki/Data_type

W3Schools;Java User Input (Scanner); Norway, 2020 https://www.w3schools.com/java/java_user_input.asp

W3resource;Java Arithmetic Operators; India, 2020 https://www.w3resource.com/java-tutorial/java-arithmetic-operators.php

Java: A Framework for Programming and Problem Solving; Kenneth Lambert and Martin Osborne;Singapore, 2002

Teacher’s Remarks: ______ Complete ______ Incomplete ______ Redo ______ For Consultation

Page 23 of 44

Computer Site Ins.

Inc.

INDEPENDENT STUDY GUIDE

(ISG)

Subject No.

Programming – Java 1 7

Name Grade/Section Score / Teacher: Miss Kaye Lopez Date

Content Standard/Topic: CONTROL STRUCTURES – IF…THEN…ELSE STATEMENT

Objectives – At the end of this ISG, I will learn to

1. Explain what is a control structures. 2. Explain what is a selection control structures. 3. Use If…then…else statement.

Introduction A control structure is like a block of programming that analyses variables and chooses a direction in which to go based on given parameters. The term flow control details the direction the program takes (which way program control "flows"). Hence it is the basic decision-making process in computing; It is a prediction.

Discussion The Selection Control Structure The selection control structure allows one set of statements to be executed if a condition is true and another set of actions to be executed if a condition is false. TYPES OF SELECTION CONTROL STRUCTURE

1) "If-Then-Else" structure, is flowcharted as follows:

After either the true set of actions or the false set of actions are taken, program control resumes with the next statement (the statement that would be placed below the connector in the flowchart above). The following form is preferred for implementing the If-Then-Else structure (this is the "block", or "multi-line" form of the If statement): Syntax: if ( <conditional expression> ) { <one or more statements to be executed fi condition is true> } else { <one or more statements to be executed if condition is false> } If the conditional expression is true, the statements between the keywords Then and Else will be executed (and the statements between the

Page 24 of 44

keywords Else and End If will be bypassed). If the conditional expression is false, the statements between the keywords Else and End If will be executed (and the statements between the keywords Then and Else will be bypassed). In any case, program control will resume with the statement following End If. Example: if (sngNumberOfCredits < 12) { lblStatus = "PART-TIME STUDENT" dblTuitionAmount = sngNumberOfCredits * 175 } Else { lblStatus = "FULL-TIME STUDENT" dblTuitionAmount = 2000 } STYLE TIPS FOR THE BLOCK IF STATEMENT: (1) Indent the "true" actions 4 spaces from the keyword "If" (2) Code the keyword "Else" on a separate line, aligned with the keyword "If" (3) Code the "false" actions 4 spaces from the keyword "Else" (4) Align the close curly bracket “}” with the keywords "If" and "Else" Example

Source Code [IfElseExtended] Notes

package ifelseextended; import java.util.*; public class IfElseExtended { public static void main(String[] args) { int grade=0; Scanner input = new Scanner(System.in); System.out.print("Enter a grade: "); grade = input.nextInt(); if(grade >= 75) { System.out.print("\n\nCongratulations, you passed."); } else { System.out.print("\n\nSorry, you failed."); } } }

this is the true path depending on the condition, granting the grade is equal or higher than 75, this will execute and ignore the false path this is the false path depending on the condition if the grade is less than 75, this will execute and will ignore the true path

Relational Operators Java has six relational operators that compare two numbers and return a boolean value. The relational operators are <, >, <=, >=, ==, and !=. x < y Less than True if x is less than y, otherwise false. x > y Greater than True if x is greater than y, otherwise false. x <= y Less than or equal to True if x is less than or equal to y, otherwise false. x >= y Greater than or equal to True if x is greater than or equal to y, otherwise false. x == y Equal True if x equals y, otherwise false. x != y Not Equal True if x is not equal to y, otherwise false. Please note that the expressions: a=5 and a==5 are different. One equal sign signifies value assignment (meaning that the value of a is 5) as two equal signs performs relational operator that compares the two numbers if they have the same value or not.

Self-Test Questions Instructions: Study each questions carefully and answer each questions in paragraph form and in Filipino language. Write your answers in a separate sheet of long bond paper. And it should be handwritten. Write your name, grade and section in the upper left part of the front side of the bond paper. Insert it in a long brown envelop and have it submitted in the drop box located in the lobby of the school.

1. Explain what is a control structure.

Page 25 of 44

2. Explain what is the use of a selection control structure. Rubrics for Essay Focus (The single controlling point made with an awareness of task about a specific topic) - 5 pts Content (The presence of ideas developed through facts, examples, details, opinions, Reasons and/or explanations) - 5 pts Conventions (Grammar, spelling, usage and sentence formation and neatness) - 5 pts Total Score - 15 pts per item

Student’s Insights

References Wikiversity; Control Structures; USA, 2020

https://en.wikiversity.org/wiki/Control_structures

TheVBProgrammer;Selection Control Structure; USA, 2020 https://www.thevbprogrammer.com/Ch05/05-03-SelectionStructure.htm

Cafeaulait; Relational Operators; USA 1999 http://www.cafeaulait.org/course/week2/35.html

Java: A Framework for Programming and Problem Solving; Kenneth Lambert and Martin Osborne;Singapore, 2002

Teacher’s Remarks: ______ Complete ______ Incomplete ______ Redo ______ For Consultation

Page 26 of 44

Computer Site Ins.

Inc.

INDEPENDENT STUDY GUIDE

(ISG)

Subject No.

Programming – Java 1 8

Name Grade/Section Score / Teacher: Miss Kaye Lopez Date

Content Standard/Topic: CONTROL STRUCTURES – IF…THEN…ELSE STATEMENT (NESTED)

Objectives – At the end of this ISG, I will learn to

1. Explain what is a nested if…then…else Statement. 2. Use Nested If…then…else statement.

Introduction A control structure is like a block of programming that analyses variables and chooses a direction in which to go based on given parameters. The term flow control details the direction the program takes (which way program control "flows"). Hence it is the basic decision-making process in computing; It is a prediction.

Discussion The Selection Control Structure The selection control structure allows one set of statements to be executed if a condition is true and another set of actions to be executed if a condition is false. TYPES OF SELECTION CONTROL STRUCTURE

2) Nested if…then…else is the same as if…then…else but with an inner if. This is usually used when there are more than 2 choices or option.

When an if statement is in the if body then both the outer if condition and the inner if conditions must evaluate to true before the inner if body can run. Example: if ( num > 90 ) { System.out.println( "You earned an A" ) ; }

Page 27 of 44

else if ( num > 80 ) { System.out.println( "You earned a B" ) ; } The statement "You earned a B" only if the outer ifcondition evaluates to false and the inner if condition evaluates to true. In other words, the first if condition has to "fail" before it's even possible that the second println() prints. The first condition failing means that num is not greater than 90, so it must be less than or equal to 90. The second condition succeeding means that num is greater than 80. Combine the two and you get num greater than 80, but less than or equal to 90. We can add yet another if statement to the else body, to take this one step further. if ( num > 90 ) { System.out.println( "You earned an A" ) ; } else if ( num > 80 ) { System.out.println( "You earned a B" ) ; } else if ( num > 70 ) { System.out.println( "You earned a C" ) ; } In this case, you don't see "You earned a C" unless the top condition fails (i.e. num > 90), and the middle condition fails (i.e. num > 80), but the bottom condition succeeds (i.e. num > 70). If you combine all the conditions together need to print "You earned a C", you get something that is less than or equal to 80, and greater than 70. if ( num > 90 ) { System.out.println( "You earned an A" ) ; } else if ( num > 80 ) { System.out.println( "You earned a B" ) ; } else if ( num > 70 ) { System.out.println( "You earned a C" ) ; } else { System.out.println(“You earned an F”); } In the last case, if all other conditions fails, the else condition succeeds (i.e. num <70). Example

Line Source Code [IfElseNested] Notes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

package ifelsenested; import java.util.*; public class IfElseNested { public static void main(String[] args) { int grade=0; Scanner input = new Scanner(System.in); System.out.print("Enter a grade: "); grade = input.nextInt(); if(grade >= 75) { System.out.print("\n\nCongratulations, you passed."); } else if (grade >= 73) { System.out.print("\n\nYou will take a remedial exam."); } else { System.out.print("\n\nSorry, you failed."); }

Declares variable Creates the scanner object for inputting Instruction to user Reads user input this is the true path for the first condition. Granting the grade is equal or higher than 75, this will execute and will ignore the rest. this is the true path for the second condition if the grade is equal of more than 73, this will execute and will ignore the rest. this is the “kung ano ang natira” path. If not the first condition and not the second condition, this will execute and will ignore the rest.

Page 28 of 44

18 19

} }

close curly bracket of line 4 close curly bracket of line 3 Note: always be careful with the curly brackets, if there’s an open curly bracket {, there should be a close curly bracket } \n – means new line or break line,

run: Enter a grade: 74 You will take a remedial exam. BUILD SUCCESSFUL (total time: 1 second)

74 is the user input

Self-Test Questions Instructions: Study each questions carefully and answer each questions in paragraph form and in Filipino language. Write your answers in a separate sheet of long bond paper. And it should be handwritten. Write your name, grade and section in the upper left part of the front side of the bond paper. Insert it in a long brown envelop and have it submitted in the drop box located in the lobby of the school.

1. Explain what is a Nested if…then…else statement. 2. Differentiate If…then…else statement from nested if…then…else statement.

Rubrics for Essay Focus (The single controlling point made with an awareness of task about a specific topic) - 5 pts Content (The presence of ideas developed through facts, examples, details, opinions, Reasons and/or explanations) - 5 pts Conventions (Grammar, spelling, usage and sentence formation and neatness) - 5 pts Total Score - 15 pts per item

Student’s Insights

References Cs.umd.edu; Incremental Java: Nested If Statement; USA, 2020

https://www.cs.umd.edu/~clin/MoreJava/ControlFlow/nested-if.html

THeVBProgrammer;Selection Control Structure; USA, 2020 https://www.thevbprogrammer.com/Ch05/05-03-SelectionStructure.htm

Java: A Framework for Programming and Problem Solving; Kenneth Lambert and Martin Osborne;Singapore, 2002

Teacher’s Remarks: ______ Complete ______ Incomplete ______ Redo ______ For Consultation

Page 29 of 44

Computer Site Ins.

Inc.

INDEPENDENT STUDY GUIDE

(ISG)

Subject No.

Programming – Java 1 9

Name Grade/Section Score / Teacher: Miss Kaye Lopez Date

Content Standard/Topic: STRING COMPARISON

Objectives – At the end of this ISG, I will learn to

1. Use If…then…else statement to compare strings . 2. Explain the difference of equals() method and equalsIgnoreCase() method.

Introduction Comparing numbers using relational operators is quite different than comparing strings in Java Language. In comparing strings, java uses equals() method and equalsIgnoreCase() method.

Discussion Java String compare We can compare string in java on the basis of content and reference. It is used in authentication (by equals() method). The String equals() method compares the original content of the string. It compares values of string for equality. String class provides two methods:

public boolean equals(Object another) compares this string to the specified object. (Case sensitive)

public boolean equalsIgnoreCase(String another) compares this String to another string, ignoring case. Example #1

Line Source Code [IfElseCharacters] Notes

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

package ifelsecharacters; import java.util.*; public class IfElseCharacters { public static void main(String[] args) { String letter=””; Scanner input = new Scanner(System.in); System.out.print("Enter a Letter: "); letter = input.nextLine(); if(letter.equals("A")) { System.out.println("\n\nA is for Apple"); } else if (letter.equals("B")) { System.out.println("\n\nB is for Banana"); } else if (letter.equals("C")) { System.out.println("\n\nC is for Clementine"); } } }

Declares variable Creates the scanner object for inputting Instruction to user Reads user input this is the true path for the first condition. Take note that we used equals() method, this will be case sensitive. Meaning A is not equal to a. But A is equal to A and a is equal to a. If you will type in small letters, it will not yield any output. close curly bracket of line 4 close curly bracket of line 3

Page 30 of 44

run: Enter a Letter: C C is for Clementine BUILD SUCCESSFUL (total time: 2 seconds)

74 is the user input

Example #2

Line Source Code [EqualsIgnore] Notes

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

package equalsignore; import java.util.*; public class EqualsIgnore { public static void main(String[] args) { Scanner input = new Scanner(System.in); String school="", color=""; System.out.print("Enter School Acronym: "); school = input.nextLine(); if(school.equalsIgnoreCase("CSII")) { color="Green and Yellow"; } else if(school.equalsIgnoreCase("ADMU")) { color="Blue and White"; } else if(school.equalsIgnoreCase("UST")) { color="Yellow and White"; } System.out.println("The School's official color is " + color); } }

This program shows the use of EqualsIgnoreCase() This method ignore the cases of the characters.

run: Enter School Acronym: csii The School's official color is Green and Yellow BUILD SUCCESSFUL (total time: 4 seconds)

Self-Test Questions Instructions: Study each questions carefully and answer each questions in paragraph form and in Filipino language. Write your answers in a separate sheet of long bond paper. And it should be handwritten. Write your name, grade and section in the upper left part of the front side of the bond paper. Insert it in a long brown envelop and have it submitted in the drop box located in the lobby of the school.

1. Explain the logical sequence of the second example. 2. Differentiate equals() method from equalsIgnoreCase() method.

Rubrics for Essay Focus (The single controlling point made with an awareness of task about a specific topic) - 5 pts Content (The presence of ideas developed through facts, examples, details, opinions, Reasons and/or explanations) - 5 pts Conventions (Grammar, spelling, usage and sentence formation and neatness) - 5 pts Total Score - 15 pts per item

Page 31 of 44

Student’s Insights

References

Cs.umd.edu; Incremental Java: Nested If Statement; USA, 2020 https://www.cs.umd.edu/~clin/MoreJava/ControlFlow/nested-if.html

THeVBProgrammer;Selection Control Structure; USA, 2020 https://www.thevbprogrammer.com/Ch05/05-03-SelectionStructure.htm

Javatpoint; Java String Compare; USA, 2018 https://www.javatpoint.com/string-comparison-in-java

Java: A Framework for Programming and Problem Solving; Kenneth Lambert and Martin Osborne;Singapore, 2002

Teacher’s Remarks: ______ Complete ______ Incomplete ______ Redo ______ For Consultation

Page 32 of 44

Computer Site Ins.

Inc.

INDEPENDENT STUDY GUIDE

(ISG)

Subject No.

Programming – Java 1 10

Name Grade/Section Score / Teacher: Miss Kaye Lopez Date

Content Standard/Topic: Control Structures – If…Then…Else Statement (Multiple Conditions)

Objectives – At the end of this ISG, I will learn to

1. Identify the different logical operators. 2. Use the different logical operators in a multiple condition statements.

Introduction When using if…then…else statement, we need to include a condition. But it does not necessarily has to be one condition. It could be multiple conditions depending on the program requirements.

Discussion LOGICAL OPERATORS IN JAVA A logical operator (sometimes called a “boolean operator”) in java programming is an operator that returns a boolean result that’s based on the boolean result of one or two other expressions. Sometimes, expressions that use logical operators are called “compound expressions” because the effect of the logical operators is to let you combine two or more condition tests into a single expression.

OPERATOR NAME Description Sample

! not Returns true if the operand to the right evaluates to false. Returns false if the operand to the right is true.

Not true = false Not false = true

&& And Returns true if both of the operands evaluate to true. Both operands are evaluated before the And operator is applied.

true and true = true true and false = false false and true = false false and false = false

|| Or Returns true if at least one of the operands evaluates to true. Both operands are evaluated before the Or operator is applied.

true or true = true true or false = true false or true = true false or false = false

Syntax: if ( <conditional expression1> Logical_operator <conditional expression2> ) Example: if ( num <100 && num>=1 ) Example

Line

Source Code [MultipleCondition]

Notes

1 2 3 4 5 6 7 8 9 10

package multiplecondition; import java.util.*; public class MultipleCondition { public static void main(String[] args) { int num=0; Scanner input = new Scanner(System.in); System.out.print("Enter a number: "); num = input.nextInt(); if(num <100 && num>=1) { System.out.println("Its a two digit number");

Declares variable Creates the scanner object for inputting Instruction to user Reads user input this is the true path for the first condition.

Page 33 of 44

11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

} else if(num <1000 && num>=100) { System.out.println("Its a three digit number"); } else if(num <10000 && num>=1000) { System.out.println("Its a four digit number"); } else if(num <100000 && num>=10000) { System.out.println("Its a five digit number"); } else { System.out.println("number is not between 1 & 99999"); } } }

this is the true path for the second condition This is the true path for the third condition This is the true path for the fourth condition Else path, whatever remains or not in the choices Close curly bracket for line 4 Close curly bracket for line 3

run: Enter a number: 250 Its a three digit number BUILD SUCCESSFUL (total time: 5 seconds)

250 is the user’s input

Self-Test Questions Instructions: Study each questions carefully and answer each questions in paragraph form and in Filipino language. Write your answers in a separate sheet of long bond paper. And it should be handwritten. Write your name, grade and section in the upper left part of the front side of the bond paper. Insert it in a long brown envelop and have it submitted in the drop box located in the lobby of the school.

1. Explain the different logical operators. Rubrics for Essay Focus (The single controlling point made with an awareness of task about a specific topic) - 5 pts Content (The presence of ideas developed through facts, examples, details, opinions, Reasons and/or explanations) - 5 pts Conventions (Grammar, spelling, usage and sentence formation and neatness) - 5 pts Total Score - 15 pts per item

Student’s Insights References

Beginners Book; If, If..else Statement in Java with Examples; USA, 2020 https://beginnersbook.com/2017/08/if-else-statement-in-java/

C4learn;Java If Statement; USA, 2015 http://www.c4learn.com/java/java-if-statement/

Dummies; Java for Dummies; USA, 2019 https://www.dummies.com/programming/java/logical-operators-in-java/

Java: A Framework for Programming and Problem Solving; Kenneth Lambert and Martin Osborne;Singapore, 2002

Teacher’s Remarks: ______ Complete ______ Incomplete ______ Redo ______ For Consultation

Page 34 of 44

Computer Site Ins.

Inc.

INDEPENDENT STUDY GUIDE

(ISG)

Subject No.

Programming – Java 1 11

Name Grade/Section Score / Teacher: Miss Kaye Lopez Date

Content Standard/Topic: CONTROL STRUCTURES – SWITCH STATEMENT

Objectives – At the end of this ISG, I will learn to

1. Explain what is a switch statement. 2. Use the switch statement in a program. 3. Identify the use of break statement.

Introduction In computer programming languages, a switch statement is a type of selection control mechanism used to allow the value of a variable or expression to change the control flow of program execution via search and map. Switch statement is also a type of selection control structures.

Discussion SWITCH STATEMENT The switch statement behaves very much like an extended if statement, and although it is not as general as an extended if statement, it is considerably less cumbersome to use. Here is the syntax: switch (expression) { case literal1: group of statements; break; case literal2: group of statements; break; …… case n: group of statements; break; default: //this part group of statements; // is break; // optional } The switch statement begins by comparing the expression to the literals. If there is a matching literal, the corresponding group of statements is executed; otherwise, the statements following the keyword default are executed (if this optional group is present). If the keyword break is missing, execution continues into the next group. The expression must yield a value of type byte, long, int or char and the literals must be of the same type as the expression. BREAK STATEMENT Sometimes we want to break out of a loop prematurely. The break statement provides a simple mechanism for doing so. The break statement just presented breaks out of the immediately enclosing loop. Example

Line Source Code [SwitchStatement] Explanation

1 2

package switchstatement; import java.util.*;

2 Flowchart of a switch statement

Page 35 of 44

3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29

public class SwitchStatement { public static void main(String[] args) { String school=””, color=""; Scanner input = new Scanner(System.in); System.out.print("Enter School Acronym: "); school = input.nextLine(); switch( school.toLowerCase() ) { case "csii": color = "Green and yellow"; break; case "up": color = "Maroon and white"; break; case "admu": color = "Blue and white"; break; default: color=""; } if(color.equals("")) { System.out.print("School not available"); } else { System.out.print("\n\n" + color + " is " + school.toUpperCase() + "'s official color"); } } }

Instruction to the user to input school acronym Reads user input Start of switch statement, please take note that I have used the .toLowerCase() function. The purpose of this function to convert user’s input into lowercase or small letters. When using this function make sure that the literals are also in small letters, otherwise, it will never be equal First literal is equal to “csii”. Please note that “csii” are in small caps Second literal is equal to “up” Third literal is equal to “admu” Default means or else. Kapag wala sya sa mga nabanggit na literals, dito papasok yung expression. Pag wala sa nabanggit, ang value ng color ay empty. //this is the end of the switch statement This part is only included to check if the variable color has content. If none, “School not available” message will be shown If the variable color has content, it will show the official color of the school, please take note that I have used toUpperCase(). In contrast to toLowerCase(), toUpperCase() converts the content of the variable school into capital letters. //end of if…then…else statement Close curly bracket of line 4 Close curly bracket of line 3

Self-Test Questions Instructions:

a) Study the program block carefully. Convert the block of if…the…else statement into switch statement. b) Write your answers in a separate sheet of long bond paper. And it should be handwritten. Write your name, grade and section in the

upper left part of the front of the bond paper. c) Insert it in a long brown envelop and have it submitted in the drop box located in the lobby of the school.

1. You need to create a scanner object and declare the variables 2. Input grade. Instructions to the user must be “Enter a grade [a, b or c]: “ 3. If (grade == ‘a’)

Message = “Excellent” Else if (grade == ‘b’) Message = “Very Good” Else if (grade == ‘c’) Message = “Average” Else

Page 36 of 44

Message = “Unacceptable” 4. Show the message

Rubrics for Programs

Criteria 5-Excellent 3-Good 2-Poor 1-Unacceptable Score

Solution Completed solution runs without errors. Meets all specifications

Completed solution is tested and runs but does not meet all the specifications and/or work for all test data.

Completed solution is implemented on the required platform. It runs, but has logical errors.

Incomplete solution is implemented on the required platform. Does not complie and/or run.

Program Design

Program design uses appropriate structures. The overall program design appropriate.

Program design generally uses appropriate structures. Program elements exhibit good design.

Not all of the selected structures are appropriate. Some of the program elements are appropriately designed.

Few of the selected structures are appropriate. Program elements are not well designed.

User Interface User interaction is as specified and is natural to the user

User interaction generally meets the specifications and is acceptable

User interaction minimally meets the specifications, but does not increase usability

User interaction is incomplete and does not meet specifications.

Total Score

Student’s Insights

References

Wikipedia;Switch Statement; USA, 2020 https://en.wikipedia.org/wiki/Switch_statement

Tutorialspoint;JavaScript – Switch Case; USA, 2020 https://www.tutorialspoint.com/javascript/javascript_switch_case.htm

Java: A Framework for Programming and Problem Solving; Kenneth Lambert and Martin Osborne;Singapore, 2002

Teacher’s Remarks: ______ Complete ______ Incomplete ______ Redo ______ For Consultation

Page 37 of 44

Computer Site Ins.

Inc.

INDEPENDENT STUDY GUIDE

(ISG)

Subject No.

Programming – Java 1 12

Name Grade/Section Score / Teacher: Miss Kaye Lopez Date

Content Standard/Topic: CONTROL STRUCTURES – WHILE STATEMENT

Objectives – At the end of this ISG, I will learn to

1. Explain what is an iteration control structure. 2. Identify the different types of iteration control structure. 3. Explain how while statement works. 4. Use the while statement in a program. 5. Explain what are the counters and accumulators. 6. Use the counters and accumulators in a program.

Introduction Repetition control structures, also referred to as iteration control structures, are groupings of code which are designed to repeat a set of related statements. This repetition (or iteration) can repeat zero or more times, until some control value or condition causes the repetition to cease. Types of repetition control structures are while statement and for loop statement.

Discussion WHILE STATEMENT The while statement implements a loop. It allows the statement or group of statements inside the loop to execute repeatedly while a condition remains true. Here is the while statement’s format: Syntax: while (condition) { //loop test Statement1; // inside Statement2; // the …. // loop } If the condition is false from the outset, the statement or statements inside the loop never execute. COUNTERS When one needs to count how many times a program executes a loop (without using a counted loop), one uses a counter. Counters need two things in order to function: 1) an Initial Value, and; 2) an Incremental Value. The initial value is usually (but not always) zero, and must be located outside the loop. It tells the program what number to begin counting at. The incremental value, on the other hand, tells the program what to count by (one's usually, but it could be any number) and must be located inside the loop. Syntax: var = var + x //where x is a constant Initial value initial value incremental value Example: ctr = 0; Ctr = ctr +1; //everytime is loops, a value of 1 is added to the ctr variable Accumulators Accumulators are identical to counters with one difference. While they must have both an initial value and an incremental value; the incremental value is determined by a variable. Accumulators are used to keep a running total of numbers during successive passes through a loop. Syntax: var = var + x //where x is also a variable Initial value initial value incremental value

3Flowchart of a While Statement

Page 38 of 44

Example: sale = 2, totalsale=0; totalsale = totalsale +sale; //everytime is loops, a value of the variable sale is // added to the totalsale variable Example #1

Line Source Code [WhileStatement] Explanation 1 2 3 4 5 6 7 8 9 10 11

package whilestatement; public class WhileStatement { public static void main(String[] args) { int sum= 0, i=1; while (i <= 100) { sum = sum + i; i = i +1; } System.out.println("Total is " + sum); } }

This program will print the sum of the integers from 1 to 100 Variable declaration Beginning of while statement with a condition that will allow the repetition if the value of I is less than or equal to 100 This is an accumulator This is a counter that will allow the condition to add 1 more value Close curly bracket for line 5 This line will show the result of the accumulator Close curly bracket for line 3 Close curly bracket for line 2

run: Total is 5050 BUILD SUCCESSFUL (total time: 0 seconds)

This program has no input, Sum of all the integers from 1 to 100

Example #2

Line Source Code [WhileStatement2] Explanation

1 2 3 4 5 6 7 8 9 10 11 12 13

package whilestatement2; import java.util.*; public class WhileStatement2 { public static void main(String[] args) { Scanner input = new Scanner(System.in); String ans="Y"; while (ans.equalsIgnoreCase("y")) { System.out.println("\nThe password is 'CSII'"); System.out.print("Show Password again? [Y/N] "); ans = input.nextLine(); } } }

This program will show the password and ask again if the user wishes to see it again. Declaration of Scanner object Declaration of variable Beginning of while statement with the condition that it will repeat if the user answers ‘Y’ Shows the password Asks the user if user wants to see the password again User input. Please note that the variable used is the same as the variable line 7 Close curly bracket for line 7 – while statement Close curly bracket for line 4 Close curly bracket for line 3

run: The password is 'CSII' Show Password again? [Y/N] y The password is 'CSII' Show Password again? [Y/N] Y The password is 'CSII' Show Password again? [Y/N] n BUILD SUCCESSFUL (total time: 7 seconds)

Shows password Ask user, and user answered small ‘y’ Shows password again Ask user, and user answered big ‘Y’, it will repeat as the program used equalsIgnoreCase() - see line 7 Shows password again Ask user, and user answered ‘n’ Program stopped

Page 39 of 44

Self-Test Questions Instructions: Study each questions carefully and answer each questions in paragraph form and in Filipino language. Write your answers in a separate sheet of long bond paper. And it should be handwritten. Write your name, grade and section in the upper left part of the front side of the bond paper. Insert it in a long brown envelop and have it submitted in the drop box located in the lobby of the school.

1. Explain how the while statement works. 2. Explain the difference of counters and accumulators and explain how they work. 3. What is an iteration control structure?

Rubrics for Essay Focus (The single controlling point made with an awareness of task about a specific topic) - 5 pts Content (The presence of ideas developed through facts, examples, details, opinions, Reasons and/or explanations) - 5 pts Conventions (Grammar, spelling, usage and sentence formation and neatness) - 5 pts Total Score - 15 pts per item

Student’s Insights

References

University of Cincinnati;Introduction to Repetition Structures; USA, 2020 https://homepages.uc.edu/~thomam/Intro_OOP_Text/Loops.html

Tutorialspoint;While Loop in C; USA, 2020 https://www.tutorialspoint.com/cprogramming/c_while_loop.htm

Flylib; Counter and Accumulator Variables; USA, 2017 https://flylib.com/books/en/2.517.1.73/1/

Java: A Framework for Programming and Problem Solving; Kenneth Lambert and Martin Osborne;Singapore, 2002

Teacher’s Remarks: ______ Complete ______ Incomplete ______ Redo ______ For Consultation

Page 40 of 44

Computer Site Ins.

Inc.

INDEPENDENT STUDY GUIDE

(ISG)

Subject No.

Programming – Java 1 13

Name Grade/Section Score / Teacher: Miss Kaye Lopez Date

Content Standard/Topic: CONTROL STRUCTURES – FOR…LOOP STATEMENT

Objectives – At the end of this ISG, I will learn to

1. Explain how for…loop statement works. 2. Use the for… loop statement in a program.

Introduction Repetition control structures, also referred to as iteration control structures, are groupings of code which are designed to repeat a set of related statements. This repetition (or iteration) can repeat zero or more times, until some control value or condition causes the repetition to cease. Types of repetition control structures are while statement and for loop statement.

Discussion FOR…LOOP STATEMENT Loops are used to execute a set of statements repeatedly until a particular condition is satisfied. The for loop statement provides a looping construct but unlike while statement that will continue looping so long the condition is satisfied, in for loop statement it will only loop in a specified number of times. Syntax of for loop: for(initialization; condition ; increment/decrement) { statement; …. statement; } In this syntax:

Initialization – needed before entering the loop for the first time. This is the value with which for..loop will start counting

Condition – is the test that is executed at the beginning of each loop or iteration. Indicates when for…loop will stop counting.

Increment/decrement - does what is needed to prepare for the next iteration around the loop. Indicates if it will count ascending or descending.

Example #1

Line Source Code [Forloop1] Explanation

1 2 3 4 5 6

package forloop1; public class Forloop1 { public static void main(String[] args) { int x=10; for (x=10; x>=1; x-- ) { System.out.println("Value of x is " + x);

The program will show the value of x in descending order. Declares the variable x with initial value of 10 Start of for loop statement. Where in it will start counting at 10, it will stop if it reaches 1 and it will count in descending manner Shows the value of x

4 Flowchart for For loop statement

Page 41 of 44

7 8 9

} } }

Close curly bracket for the for loop statement Close curly bracket for line 3 Close curly bracket for line 2

run: Value of x is 10 Value of x is 9 Value of x is 8 Value of x is 7 Value of x is 6 Value of x is 5 Value of x is 4 Value of x is 3 Value of x is 2 Value of x is 1 BUILD SUCCESSFUL (total time: 0 seconds)

This program does not require inputs

Example #2

Line Source Code Explanation

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

package forloop2; import java.util.*; public class ForLoop2 { public static void main(String[] args) { int totalsale=0, sale=0, ctr=0; Scanner input = new Scanner(System.in); for (ctr =1; ctr<=5; ctr ++) { System.out.println("\nDay " + ctr + ": "); System.out.print("Enter sales for today: "); sale = input.nextInt(); totalsale = totalsale + sale; } System.out.println("\nTotal Sale for this week is " + totalsale); } }

This program accepts user input for daily sale within a week (5 days). The program will accumulate all inputted sales using accumulators. Variable declaration ctr is used for the for loop statement Declaration of the scanner object Beginning of for loop statement. It will start counting at 1, will stop when it reaches 5 and it will count in ascending order Shows the day number Shows instruction to the user to input sale Reads user input This is the accumulator that will add up all inputs End of for loop statement Show the total sale for the week Close curly bracket for line 4 Close curly bracket for line 3

run: Day 1: Enter sales for today: 100 Day 2: Enter sales for today: 100 Day 3: Enter sales for today: 100 Day 4: Enter sales for today: 100 Day 5: Enter sales for today: 100 Total Sale for this week is 500 BUILD SUCCESSFUL (total time: 7 seconds)

Page 42 of 44

Self-Test Questions Instructions: Study each questions carefully and answer each questions in paragraph form and in Filipino language. Write your answers in a separate sheet of long bond paper. And it should be handwritten. Write your name, grade and section in the upper left part of the front side of the bond paper. Insert it in a long brown envelop and have it submitted in the drop box located in the lobby of the school.

1. Explain how the for…loop statement works. 2. Explain the difference between for… loop statement and while statement.

Rubrics for Essay Focus (The single controlling point made with an awareness of task about a specific topic) - 5 pts Content (The presence of ideas developed through facts, examples, details, opinions, Reasons and/or explanations) - 5 pts Conventions (Grammar, spelling, usage and sentence formation and neatness) - 5 pts Total Score - 15 pts per item

Student’s Insights

References

BeginnersBook;For Loop in Java with example; USA, 2020 https://beginnersbook.com/2015/03/for-loop-in-java-with-example/

Tutorialspoint;For Loop in Java; USA, 2020 https://www.tutorialspoint.com/java/java_for_loop.htm

Java: A Framework for Programming and Problem Solving; Kenneth Lambert and Martin Osborne;Singapore, 2002

Teacher’s Remarks: ______ Complete ______ Incomplete ______ Redo ______ For Consultation

Page 43 of 44

Computer Site Ins.

Inc.

INDEPENDENT STUDY GUIDE

(ISG)

Subject No.

Programming – Java 1 14

Name Grade/Section Score / Teacher: Miss Kaye Lopez Date

Content Standard/Topic: PROGRAMMING – JAVA 1

Objectives – At the end of this ISG, I will learn to

1. Design a workable program. 2. Develop a program that could be used in our everday life.

Introduction This is the last Independent Study Guide for the subject Programming – Java 1. For this week, you will be working on a major program that will require everything that you have learned from Independent Study Guide No. 1 to Independent Study Guide No. 13.

Discussion REVIEW OF THE ENTIRE MODULE

Please refer to ISG-1-ProgrammingJava1-11-1 for Computer Programming Basics Please refer to ISG-1-ProgrammingJava1-11-2 for Program Design Tools - Algorithm

Please refer to ISG-1-ProgrammingJava1-11-3 for Program Design Tools - Flowchart

Please refer to ISG-1-ProgrammingJava1-11-4 for Java Programming - Introduction

Please refer to ISG-1-ProgrammingJava1-11-5 for Displaying Output Please refer to ISG-1-ProgrammingJava1-11-6 for Data Inputting

Please refer to ISG-1-ProgrammingJava1-11-7 for Control Structures – If…then…else Statement

Please refer to ISG-1-ProgrammingJava1-11-8 for Control Structures – If…then…else Statement (Nested)

Please refer to ISG-1-ProgrammingJava1-11-9 for String Comparison Please refer to ISG-1-ProgrammingJava1-11-10 for Control Structures – If…then…else Statement (Multiple Conditions)

Please refer to ISG-1-ProgrammingJava1-11-11 for Control Structures – Switch Statement

Please refer to ISG-1-ProgrammingJava1-11-12 for Control Structures – While Statement

Please refer to ISG-1-ProgrammingJava1-11-13 for Control Structures – For…Loop Statement

Self-Test Questions Instructions: Study each questions carefully and answer each questions in paragraph form and in Filipino language. Write your answers in a separate sheet of long bond paper. And it should be handwritten. Write your name, grade and section in the upper left part of the front side of the bond paper. Insert it in a long brown envelop and have it submitted in the drop box located in the lobby of the school.

1. Explain the different control structures discussed in Programming-Java1. There are two (2). 2. Explain the difference of If…then…else statement and switch statement. 3. Cite the different data types discussed and give examples for each type.

Rubrics for Essay Focus (The single controlling point made with an awareness of task about a specific topic) - 5 pts Content (The presence of ideas developed through facts, examples, details, opinions, Reasons and/or explanations) - 5 pts Conventions (Grammar, spelling, usage and sentence formation and neatness) - 5 pts Total Score - 15 pts per item

Page 44 of 44

Student’s Insights

References

Please see each Independent Study Guide for the different references used to develop this module.

Teacher’s Remarks: ______ Complete ______ Incomplete ______ Redo ______ For Consultation