0% found this document useful (0 votes)
26 views

PRELIM Lesson 2

The document discusses algorithms, flowcharts, data types, and pseudocodes. It defines these terms and provides examples of each. It also discusses the relationship between flowcharts and pseudocodes in planning programs.

Uploaded by

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

PRELIM Lesson 2

The document discusses algorithms, flowcharts, data types, and pseudocodes. It defines these terms and provides examples of each. It also discusses the relationship between flowcharts and pseudocodes in planning programs.

Uploaded by

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

Lesson 2: Algorithms, Flowcharts,

Data Types, and Pseudocodes


Introduction
Problem solving is a part of our everyday life. In computer
programming, problem solving is inevitable too and it is actually
one of the main reasons why a program is created. In this lesson, we
will learn the various concepts on how to plan a program's output,
step by step, using algorithm applied to pseudocode and flowchart.
Identifying variables and the corresponding data types will also be
discussed in this lesson.
WHAT IS AN ALGORITHM?
Generally, an algorithm is a step-by-step procedure to solve
problems. A guide for installing new software, a manual for assembling
appliances, and even recipes are examples of an algorithm. In
programming, making an algorithm is exciting—they are expressed in a
programming language or in a pseudocode.
Algorithm makes the whole procedure
more efficient as well as consistent. It also
helps in identifying decision points,
processes, and essential variables to solve
the problem. A programmer can also see
and determine easily the errors in a
particular process using an algorithm.
WHAT IS A PSEUDOCODE?
A pseudocode is a description of an algorithm or a computer program
using natural language. Because the aim of pseudocode is to make
reading program easier, some codes that are not essential for human
understanding are omitted. This language is commonly used in planning
out the structure of a program or a system, like the blueprint for creating a
house or a building.

Code in JAVA
WHAT IS A FLOWCHART?

Like pseudocodes, flowchart is also a description of an algorithm or a


computer program. It also serves as the program's blueprint during the
Program Development Process. The difference is that flowchart is a
graphical representation of it. Flowcharts help in the effective analysis of
the problem as well as the application's or program's maintenance, thus
providing ease in identifying potential improvements of the system or
program.
WHAT IS A FLOWCHART?

Input/Output

flowline
EXAMPLES of a FLOWCHART?
WHAT IS THE RELATIONSHIP OF FLOWCHARTS AND
PSEUDOCODES IN PLANNING?
Identifying System Specification and Requirements
In this substage of Planning, the needed description of the system or
application is acquired. Purposes, system and user interfaces, database
requirements, quality standards, operations, overview of the whole
application, and other requirements needed for the project development is
defined. This substage helps the programmers as well as the clients in
foreseeing the scope and limitation of the application to be made. After
identifying all the needed details, programmers can now create the
application or system's pseudocode and flowchart.
WHAT IS THE RELATIONSHIP OF FLOWCHARTS AND
PSEUDOCODES IN PLANNING?

Creating the Applicable Diagram Based on the Acquired


Requirement
This substage is all about creating flowcharts and pseudocodes
based on the requirements acquired from the previous substage,
specifically from the identifying the system and user interface as well as
the database requirements. From those given data, programmers may now
start creating the applicable diagram that will serve as the blueprint for the
logical processes of the system itself.
WHAT IS THE RELATIONSHIP OF FLOWCHARTS AND
PSEUDOCODES IN PLANNING?
Obtaining Design Documentation
Design documentation is the written description of the overall design or
architecture of the system to be made. Imagine this substage as creating the
architecture of a building and the system or application is the building itself. It has four
parts: Responsibility-driven design, Architectural Design, User Interface Design, and
Procedural Design.
· Responsibility-driven Design - describes the roles of each object in the user
interface and the information they share.
· Architectural Design - establishes the input and output flow of the program.
Flowchart-making is one of the components of this design.
· User-Interface Design - focuses on user's interaction towards GUI.
· Procedural Design - let the programmers use the proposed system's flowchart
or pseudocode and translate them into code.
WHAT IS A DATA TYPE?
A data type is a description of a specific data that can be stored in a variable, the
amount of memory the item occupies, and the operations it can be performed.

Below are the data type summary for the programming language.
,
Keyword Common Language Runtime
Type Structure Value Range
Boolean System.Boolean A Boolean value - true or false

Byte System.Byte 0 to 255

Char System.Char 0 to 65535

Date System.Date Time January 1, 0001 to December 31, 9999

+/-79,228,162,514,264,337,593,543,950,335 with no decimal point; +/-


Decimal System.Decimal 7.9228162514264337593543950335 with 28 places to the right of the
decimal; smallest non-zero number is +/-
0.0000000000000000000000000001

Double (double - -1.79769313486231E+308 to 4,94065645841247E324 for negative


precision floating System.Double values; 4.94065645841247E-324 to 1.79769313486231E+308 for
point) positive values
WHAT IS A DATA TYPE?
Integer System.Int32 -2,147,483,648 to 2,147,483,647

Long (long Systemint64 -9,223,372,036,854,775,808 to


9,223,372,036,854,775,807
integer)

Object System.Object (class) Any type can be stored in a variable of type Object

Short System.Int16 -32,768 to 32,767

Single (single-
System.Single -3.402823E+38 to -1.401298E-45 for negative values;
precision 1.401298E-45 to 3.402823E+38 for positive values
floating- point)

String System.String (class) 0 to approx. 2 billion Unicode characters


DATA TYPES
Boolean - can only contain two values, true or false. Yes or No or ON
and OFF is also possible.
Ex: true and false literals:
boolean myBoolean = true;
boolean anotherBoolean = false;

Byte - data type to be used if you want to store binary data (set of 0s
and 1s). It is an unsigned type that cannot contain negative
values
Ex: Using byte in arithmetic operations:
byte a = 10;
byte b = 20;
byte c = (byte) (a + b);
DATA TYPES
Char - used to hold a single character, specifically a single unicode
character. Unicode is a 16-bit character which represents all the letters and
symbols of all major languages existing.
Ex: Declaring a char variable:
char myChar = 'A';

Date - data type that holds date values, time values, or the combination
of both.
Ex: Creating a Date object representing the current date and time:
Date now = new Date();
DATA TYPES
Decimal - holds decimal values up to 29 significant digits. It is
specifically designed for financial calculations.
Ex: Using the BigDecimal class to represent decimal numbers with arbitrary precision:
BigDecimal bigDecimal1 = new BigDecimal("12345678901234567890.12345678901234567890");
BigDecimal bigDecimal2 = new BigDecimal("0.0000000000000000000000000000000000000123456789");
BigDecimal sum = bigDecimal1.add(bigDecimal2);
BigDecimal product = bigDecimal1.multiply(bigDecimal2);

Double - powerful data type that can hold even the smallest and the
largest approximation of a real number.
Ex: Declaring a double variable:
double myDouble = 3.14159;
DATA TYPES
Integer - holds only whole number, but loads fast compare to other
data types.
Ex: Declaring an int variable:
int myInt = 42;

Long - data type used to hold larger integer numbers.


Ex: Declaring a long variable:
long myLong = 123456789L; // Note the "L" suffix to indicate a long literal
DATA TYPES

Object - holds objects' addresses.


Ex: Declaring an object variable:
String myString; // Declare a reference variable for a String object
Date myDate; // Declare a reference variable for a Date object
Scanner myScanner; // Declare a reference variable for a Scanner object

Ex: Creating an object and assigning it to a variable:


String myString = new String("Hello, world!"); // Create a String object
Date myDate = new Date(); // Create a Date object with the current date and time
Scanner myScanner = new Scanner(System.in); // Create a Scanner object to read input from the console
DATA TYPES
Short - used to contain lesser value of whole number compared to data
type Integer. Programmers use this data type to optimize program runtime
as well as to save memory.
Ex: Declaring a short variable:
short myShort = 12345;

Single (float) - like double data type, it is also used to contain floating-
point values. The difference is that it is used for much lesser values. float
can be useful in cases where memory usage is a concern and the level of
precision provided by double is not necessary.
Ex: Declaring a float variable:
float myFloat = 1.23f; //Note that the f at the end of the number is required to indicate that it is a float value.
DATA TYPES
String - data type used to hold set or multiple of characters, like words
and sentences.
Ex: Declaring a String variable:
String myString = "Hello, world!";

Ex: Concatenating String values:


String firstName = "John";
String lastName = "Doe";
String fullName = firstName + " " + lastName;
String message = "Hello, " + fullName + "!";
END

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy