0% found this document useful (0 votes)
809 views13 pages

Java Reviewer

The document discusses the program development life cycle and its phases: analyzing problems, designing programs, coding and execution, testing and debugging, formalizing solutions, and documenting programs. It also covers programming concepts like algorithms, flowcharts, syntax, and comments in programming languages like Java.

Uploaded by

Marc Abhel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
809 views13 pages

Java Reviewer

The document discusses the program development life cycle and its phases: analyzing problems, designing programs, coding and execution, testing and debugging, formalizing solutions, and documenting programs. It also covers programming concepts like algorithms, flowcharts, syntax, and comments in programming languages like Java.

Uploaded by

Marc Abhel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

REVIEWER JAVA III

Program Development Life Cycle

 Just like every other process, programming also follows a cycle –PDLC or program
development life cycle.
 Usually, the cycle consists of the phases illustrated at the right.
1. Analyze the Problem
2. Design the Program
3. Coding and Execution
4. Testing and Debugging
5. Formalize the Solution
6. Documentation

Analyze the Problem

• Before anything else, the program requirements should be


clearly defined.
• What is the program for?
• What does it do?
Analyze the Problem (cont.)
1. Requirements gathering - The programmers, or sometimes business analysts, meet and converse with
the client and end users to learn about their expectations from the program / software to be developed

2. Organizing requirements – The requirements are arranged in order of importance, urgency and
convenience

3. Negotiation & discussion - If there are confusing or vague requirements, a negotiation is conducted
and discussed with the stakeholders.

4. Documentation – Formal, informal, functional and non-functional requirements must be documented


properly for the next phase of the program development life cycle.
Chapter 1 : PROGRAMMING CONCEPTS
PROGRAM - A program is a list of instructions written in a programming language that a computer can
execute so that the machine acts in a predetermined way.

There are two ways of doing this, either compile the program or interpret the program. The process of
compiling and interpreting a program can be accomplished by using other programs called compilers
and interpreters, these programs translate the program written in high-level language into machine
Two types of Programming Paradigm
1. Structured Programming

known as procedural programming that uses the principles of Top- Down Design Principle was first
created by Dr. Edsger W. Dijktstra in 1960s. It uses the following control structures:

a. Sequence - ordered statements or subroutines executed in sequence.

b. Selection / Condition-one or a number of statements are executed depending on the state of the
program. This is usually expressed with keywords such as if-then-else and switch case statements.

c. Iteration / Loops- A statement or block is executed until the program reaches a certain state,
oroperations have been applied to every element of a collection.

Example of structure programming language as COBOL, ALGOL FORTRAN, SNOBOL, LOGO, Pascal,
BASIC, Modula-2, C, Perl, PL/I.

2. Object Oriented Programming

A programming paradigm based on the concept of "objects", which are data structures that contain data,
in the form of fields, often known as attributes;

This object-oriented programming concept was first introduced in the 1960's in a programming language
called Simula 67 that is created by Ole- Johan Dahl and Kristen Nygaard at the Norwegian Computing
Center in Oslo, Norway.

Major Components of Object-Oriented Programming Design the Program

a. Object - A concept, or thing with crisp boundaries and meanings for the problem at hand: an
instance of a class
b. Class-An abstraction of an object that specifies the static and behavioral characteristics of it,
including their public and private nature. A class is an ADT with a constructor template from
which object instances are created.
c. Inheritance-The relationship between classes whereby one class inherits part all of the public
descriptions of another base class, and instances inherit all the properties and methods of the
classes which they contain
d. Polymorphism-The ability of a function/operator, with one name, to refer to arguments, or
return types, of different classes at run time.
e. Abstraction- A mental facility that permits one to view problems with varying degrees of
detail depending on the current context of the problem.
f. Encapsulation - A modeling and implementation technique that separates the external aspects
of an object from the internal, implementation details of the object.
Brief History of Java
James Gosling, Mike Sheridan, and Patrick Naughton initiated the Java language project in June
1991. Java was originally designed for interactive television, but it was too advanced for the
digital cable television industry at the time. The language was initially called Oak after an oak
tree that stood outside Gosling's office. Later the project went by the name Green and was
finally renamed Java, from Java coffee. Gosling designed Java with a C/C++ style syntax that
system and application programmers would find familiar. Sun Microsystems released the first
public implementation as Java 1.0 in 1995. It promised "WriteOnce, Run Anywhere" (WORA),

Characteristics of Java
Java is simple.

Java is object-oriented.

Java is distributed.

Java is interpreted.

Java is robust.

Java is secure.

Java is architecture-neutral.

Java is portable.

Java's performance.

Java is multithreaded.

Java is dynamic.

Java Syntax of the Java programming language is the set of rules defining how a Java program is written
and interpreted.

Variable Declaration - A variable is a value that can be change depending on conditions or on


information passed to the program,
Design the Program
• Tools such as flowchart and pseudocode, which will be discussed in detail in the later part of this
module, are used in conceptualizing and designing a program.

• Now that the requirements have been identified, the next phase is designing the program.

Coding and Execution


• Once the program design has been accomplished, programmers will now proceed with the actual
coding – using a programming language like Java to write the lines of code.

Testing and Debugging


• This is done to ensure that the program works, produces the correct and intended result, and displays
it appropriately.

• “Debugging” actually means finding and removing “bugs” or errors for the program to function
properly and meet its requirements.

• Programmers are responsible for debugging their programs.

Formalize the Solution


• In this phase, the program is run to check for syntax and grammatical errors which could have been
overlooked during the coding phase.

Documentation
• In this phase, the programmers write down instructions for the end users (the ones who are going to
use the system), the purpose of the program, how it performs its functions, the input needed and the
output expected.

• Internal documentations are done by programmers through comments (this will be discussed in a later
module).

Algorithm
• Algorithm is used to describe how you do simple daily tasks or actions.

• In computer science, algorithm is defined as a procedure or formula which consists of a set of steps to
accomplish a specific task.
Flowchart
• A flowchart is a graphical representation of an algorithm using shapes and symbols to illustrate the
steps or procedure.

• It flows from top to bottom and it has a beginning and an end

• Flowcharts are prepared for the following reasons:

1. It makes the logic clear and understandable.

2. For communication purposes.

3. It is used for effective analysis.

4. It is useful during the coding phase.

5. Flowcharts are used for testing and debugging.

6. Flowcharts are part of the documentation


Flowchart (cont.)
• Take note of the general rules when constructing a flowchart:

1. All symbols used in the flowchart must be connected by flow lines.

2. Flow lines enter from the top of the symbol and exits at the bottom of the symbol; except for the
decision which can be connected by the flow lines at the bottom or side.

3. Flowcharts are drawn in a way that it logically flows from top to bottom.

4. The beginning and end of a flowchart are indicated by terminals.

5. In case the program is too complicated, use connectors.

Documentation Standards
• An effective programmer does not only write codes and programs that work without errors and bugs.
• You also have to follow coding techniques, programming practices and documentation protocols in
case new features will be added to the program: change its features, fix bugs and improve performance.
• Your codes should be readable enough so that other programmers can comprehend them very well.

Netbeans IDE (cont.)


• As for the basic parts of the Netbeans environment, take note of the following:
1. Menu Bar – this is the main menu of the Netbeans IDE. Here you will find menu items such as File,
Edit, View, Navigate and more. Each item has a set of sub-items which offer different options and actions.

2. Quick Launch Bar / Toolbar – the most commonly used actions are displayed in this toolbar

3. Projects Windows – this is where you will see the project files, classes and other Java files. Click the +
or – sign beside each folder to collapse or expand the list.

4. Navigator – this feature allows Java programmers to be oriented in source code and conduct basic
actions.

5. Working Area / Code editor – this is where you write codes

6. Assist Icons – icons that allow you to add comments and bookmarks, find selected text or code and
change indentation of codes.

7. Line Number – this tells you the line number of each line of code

8. Output Window – this is where the output is displayed

Syntax
• You’ve probably seen this word when you typed something wrong on your calculator “Syntax Error”.

• We also have “syntax” when it comes to programming.

• Basically, syntax is one of the building blocks of programming language – it is the spelling and grammar
of programming.

• You should follow it or else you’ll get an error.

JAVA COMMENTS
Comments can be used to explain Java code, and to make it more readable. It can also be used to
prevent execution when testing alternative code.

Single-line comments start with two forward slashes (//). Any text between // and the end of the line is
ignored by Java (will not be executed).
Multi-line comments start with /* and ends with */. Any text between /* and */ will be ignored by Java.

JAVA VARIABLES
Variables are containers for storing data values. In Java, there are different data types

String - stores text, such as "Hello". String values are surrounded by double quotes

int - stores integers (whole numbers), without decimals, such as 123 or -123

float - stores floating point numbers, with decimals, such as 19.99 or -19.99

char - stores single characters, such as'a' or 'B'. Char values are surrounded by single quotes

boolean - stores values with two states: true or false

JAVA DATA TYPES


As explained in the previous chapter, a variable in Java must be a specified data type:

Data types are divided into two groups:

• Primitive data types -includes byte, short, int, long, float, double, boolean and char

• Non-primitive data types - such as String, Arrays and Classes

Variables are used to store up temporary data to be used in our programs’ runtime.
Data Type – The type of data inside variable.
Identifiers– It is the name of the variable that the programmer indicated. It is used to read and write
the variable.

Rules of identifiers

-special characters are not allowed other than underscore_.

-you cannot use whitespaces.

-you cannot use numbers alone.

- you can use numbers but with letters.

Concatenation The process of joining strings together with plus operator;


“hellow”+”world”=”hellowword”

Conditional Statements

• Allows a program to take action based on the given condition. It makes our program smarter.

• Typically it compares two values so that our program can decide what action to be taken.

Relational Operators
- How are we compare our value to in value to activate our condition

Conditional Statements
Typically it compares two values so that our program can decide what action to be taken.

IF Statement -Handles 1 conditional expression, it either does something or nothing.

if (age >= 18) {System.out.println("You Have Access");}

when our value is greater than equal 18 the condition print out "You Have Access"

IF – Else Statement -Handles 2 conditional expressions, it either does the first code block or the second
code block.

if (age >= 18) {System.out.println("You Have Access");

}else{System.out.println("Access Denied");}
This is example of IF Else statement when our value is greater than equal 18 the condition print out
"You Have Access”

if the value dint get through the else will catch the condition and print out "Access Denied"

IF – Elseif - Else Statement

-Handles 3 or more Conditional Expressions, The possibility of this statements are limitless it will run a
certain code block based on the condition.

if (age >=18) {System.out.println("You Have Access");

}else if (age>=13) {System.out.println("You need parent consent");

}else{System.out.println("Access Denied");}

This just same as the other they just add ELSE IF its just like if they use ELSE IF there going to be
another condition and ELSE IF you can use it unlimited

User input and Arithmetic Operators


Built- In Packages
Java API has many pre-written classes to help the programmer manage input, database and etc.

Importing Packages
Import specific class

import packagename.classname (import java.util.Scanner:)

Import whole package

import packagename.* (import java.util.*)

User Input
String x; (you need to make a datatype that don’t have value or null)
Scanner s = new Scanner(System.in); (you need to set first a Scanner base the s is your variable)
x=s.nextLine(); (x is your variable in String and =s.nextLine)

s- is your Scanner variable

next- it depends on your datatype using

You might also like