SlideShare a Scribd company logo
1 of 12
Using Java
MINISTRY OF EDUCATION & HIGHER EDUCATION
COLLEGE OF SCIENCE AND TECHNOLOGY
KHANYOUNIS- PALESTINE
Lecture 6
Decision Making : Equality and Relational Operators
 What is the decision ?
 Equality and relational operators.
 Precedence and associatively of operations
 How to use if ?
 Practice
 Be care
 Emank X Mezank
2Presented & Prepared by: Mahmoud R. Alfarra
 For example, the condition "grade is greater
than or equal to 60" determines whether a
student passed a test.
3Presented & Prepared by: Mahmoud R. Alfarra
What is the decision ?
Note 5 applications demand the making decision
HW 5.1
 Conditions in if statements can be formed by
using the equality operators and relational
operators.
 Equality operators are used to check if two
operands are equals or not.
 Relational operators are used to check if one
of two operands are greater or less than
another.
4Presented & Prepared by: Mahmoud R. Alfarra
Equality and relational operators
5Presented & Prepared by: Mahmoud R. Alfarra
Equality and relational operators
6Presented & Prepared by: Mahmoud R. Alfarra
Precedence and associatively of operations
7Presented & Prepared by: Mahmoud R. Alfarra
How to use if ?
If (condition)
{
/*Tasks will be executed
* if the condition true*/
}
condition
yesNo
If true
Executed
at all
 Write a program to compare two numbers
and print the larger, smaller, equal or not.
8Presented & Prepared by: Mahmoud R. Alfarra
Example: Compare Integers
Write a program to calculate the summation,
multiple, division, subtraction and then compare
the results to print the larger, smaller, equal or notHW 5.2
9Presented & Prepared by: Mahmoud R. Alfarra
Example: Compare Integers
Rewrite
this
program
using
another
values
HW 5.3
10Presented & Prepared by: Mahmoud R. Alfarra
Forgetting the left and/or right parentheses for the condition
in an if statement is a syntax error the parentheses are
required.
Confusing the equality operator, ==, with the assignment
operator, =, can cause a logic error or a syntax error.
It is a syntax error if the operators ==, !=, >= and <= contain
spaces between their symbols, as in = =, ! =, > = and < =,
respectively.
Reversing the operators !=, >= and <=, as in =!, => and =<, is
a syntax error.
‫تعاىل‬ ‫هللا‬ ‫قال‬:
(‫املنفوش‬ ‫كالعهن‬‫اجلبال‬ ‫تكون‬ ‫يوم‬)
11Presented & Prepared by: Mahmoud R. Alfarra
If … else
&
The family 
12Presented & Prepared by: Mahmoud R. Alfarra

More Related Content

What's hot

Decision statements in vb.net
Decision statements in vb.netDecision statements in vb.net
Decision statements in vb.net
ilakkiya
 
Control structures in Java
Control structures in JavaControl structures in Java
Control structures in Java
Ravi_Kant_Sahu
 
Cis 355 i lab 1 of 6
Cis 355 i lab 1 of 6Cis 355 i lab 1 of 6
Cis 355 i lab 1 of 6
helpido9
 
Cis 355 i lab 2 of 6
Cis 355 i lab 2 of 6Cis 355 i lab 2 of 6
Cis 355 i lab 2 of 6
helpido9
 
Cis 355 ilab 2 of 6
Cis 355 ilab 2 of 6Cis 355 ilab 2 of 6
Cis 355 ilab 2 of 6
comp274
 

What's hot (20)

Operators, control statements represented in java
Operators, control statements  represented in javaOperators, control statements  represented in java
Operators, control statements represented in java
 
CIS 1403 lab 4 selection
CIS 1403 lab 4 selectionCIS 1403 lab 4 selection
CIS 1403 lab 4 selection
 
Vb decision making statements
Vb decision making statementsVb decision making statements
Vb decision making statements
 
Controlstatment in c
Controlstatment in cControlstatment in c
Controlstatment in c
 
Error handling and debugging in vb
Error handling and debugging in vbError handling and debugging in vb
Error handling and debugging in vb
 
Chapter 3 branching v4
Chapter 3 branching v4Chapter 3 branching v4
Chapter 3 branching v4
 
Intro To C++ - Class 12 - For, do … While
Intro To C++ - Class 12 - For, do … WhileIntro To C++ - Class 12 - For, do … While
Intro To C++ - Class 12 - For, do … While
 
Class 9 Lecture Notes
Class 9 Lecture NotesClass 9 Lecture Notes
Class 9 Lecture Notes
 
Exception handling in c++ by manoj vasava
Exception handling in c++ by manoj vasavaException handling in c++ by manoj vasava
Exception handling in c++ by manoj vasava
 
Decision statements in vb.net
Decision statements in vb.netDecision statements in vb.net
Decision statements in vb.net
 
Exception handling
Exception handlingException handling
Exception handling
 
Control structures in Java
Control structures in JavaControl structures in Java
Control structures in Java
 
Intro To C++ - Class 10 - Control Statements: Part 2
Intro To C++ - Class 10 - Control Statements: Part 2Intro To C++ - Class 10 - Control Statements: Part 2
Intro To C++ - Class 10 - Control Statements: Part 2
 
Cis 355 i lab 1 of 6
Cis 355 i lab 1 of 6Cis 355 i lab 1 of 6
Cis 355 i lab 1 of 6
 
Control structures i
Control structures i Control structures i
Control structures i
 
Cis 355 i lab 2 of 6
Cis 355 i lab 2 of 6Cis 355 i lab 2 of 6
Cis 355 i lab 2 of 6
 
Cis 355 ilab 2 of 6
Cis 355 ilab 2 of 6Cis 355 ilab 2 of 6
Cis 355 ilab 2 of 6
 
The pseudocode
The pseudocodeThe pseudocode
The pseudocode
 
Cis 355 i lab 1 of 6
Cis 355 i lab 1 of 6Cis 355 i lab 1 of 6
Cis 355 i lab 1 of 6
 
Fundamentals of programming)
Fundamentals of programming)Fundamentals of programming)
Fundamentals of programming)
 

Similar to 6 programming-using-java decision-making20102011-

Ap Power Point Chpt3 B
Ap Power Point Chpt3 BAp Power Point Chpt3 B
Ap Power Point Chpt3 B
dplunkett
 
Ap Power Point Chpt3
Ap Power Point Chpt3Ap Power Point Chpt3
Ap Power Point Chpt3
dplunkett
 
1.4 conditions and loops
1.4   conditions and loops1.4   conditions and loops
1.4 conditions and loops
allenbailey
 
Perfomance evaluation ( group 4)
Perfomance evaluation ( group 4)Perfomance evaluation ( group 4)
Perfomance evaluation ( group 4)
nurelveana
 
Case Study 1 Should a Computer Grade Your Essays1) Ident.docx
Case Study 1 Should a Computer Grade Your Essays1) Ident.docxCase Study 1 Should a Computer Grade Your Essays1) Ident.docx
Case Study 1 Should a Computer Grade Your Essays1) Ident.docx
moggdede
 

Similar to 6 programming-using-java decision-making20102011- (15)

Ap Power Point Chpt3 B
Ap Power Point Chpt3 BAp Power Point Chpt3 B
Ap Power Point Chpt3 B
 
Ap Power Point Chpt3
Ap Power Point Chpt3Ap Power Point Chpt3
Ap Power Point Chpt3
 
slides03.ppt
slides03.pptslides03.ppt
slides03.ppt
 
Ch04
Ch04Ch04
Ch04
 
1.4 conditions and loops
1.4   conditions and loops1.4   conditions and loops
1.4 conditions and loops
 
[ITP - Lecture 08] Decision Control Structures (If Statement)
[ITP - Lecture 08] Decision Control Structures (If Statement)[ITP - Lecture 08] Decision Control Structures (If Statement)
[ITP - Lecture 08] Decision Control Structures (If Statement)
 
C++ problem solving operators ( conditional operators,logical operators, swit...
C++ problem solving operators ( conditional operators,logical operators, swit...C++ problem solving operators ( conditional operators,logical operators, swit...
C++ problem solving operators ( conditional operators,logical operators, swit...
 
Perfomance evaluation ( group 4)
Perfomance evaluation ( group 4)Perfomance evaluation ( group 4)
Perfomance evaluation ( group 4)
 
Case Study 1 Should a Computer Grade Your Essays1) Ident.docx
Case Study 1 Should a Computer Grade Your Essays1) Ident.docxCase Study 1 Should a Computer Grade Your Essays1) Ident.docx
Case Study 1 Should a Computer Grade Your Essays1) Ident.docx
 
Eo gaddis java_chapter_04_5e
Eo gaddis java_chapter_04_5eEo gaddis java_chapter_04_5e
Eo gaddis java_chapter_04_5e
 
Eo gaddis java_chapter_04_5e
Eo gaddis java_chapter_04_5eEo gaddis java_chapter_04_5e
Eo gaddis java_chapter_04_5e
 
assingnment.docx
assingnment.docxassingnment.docx
assingnment.docx
 
assingnment.docx
assingnment.docxassingnment.docx
assingnment.docx
 
Operators-WPS Office.pdf
Operators-WPS Office.pdfOperators-WPS Office.pdf
Operators-WPS Office.pdf
 
Well drilling fuzzy risk assessment using fuzzy FMEA and fuzzy TOPSIS
Well drilling fuzzy risk assessment using fuzzy FMEA and fuzzy TOPSISWell drilling fuzzy risk assessment using fuzzy FMEA and fuzzy TOPSIS
Well drilling fuzzy risk assessment using fuzzy FMEA and fuzzy TOPSIS
 

More from Mahmoud Alfarra

More from Mahmoud Alfarra (20)

Chapter 10: hashing data structure
Chapter 10:  hashing data structureChapter 10:  hashing data structure
Chapter 10: hashing data structure
 
Chapter9 graph data structure
Chapter9  graph data structureChapter9  graph data structure
Chapter9 graph data structure
 
Chapter 8: tree data structure
Chapter 8:  tree data structureChapter 8:  tree data structure
Chapter 8: tree data structure
 
Chapter 7: Queue data structure
Chapter 7:  Queue data structureChapter 7:  Queue data structure
Chapter 7: Queue data structure
 
Chapter 6: stack data structure
Chapter 6:  stack data structureChapter 6:  stack data structure
Chapter 6: stack data structure
 
Chapter 5: linked list data structure
Chapter 5: linked list data structureChapter 5: linked list data structure
Chapter 5: linked list data structure
 
Chapter 4: basic search algorithms data structure
Chapter 4: basic search algorithms data structureChapter 4: basic search algorithms data structure
Chapter 4: basic search algorithms data structure
 
Chapter 3: basic sorting algorithms data structure
Chapter 3: basic sorting algorithms data structureChapter 3: basic sorting algorithms data structure
Chapter 3: basic sorting algorithms data structure
 
Chapter 2: array and array list data structure
Chapter 2: array and array list  data structureChapter 2: array and array list  data structure
Chapter 2: array and array list data structure
 
Chapter1 intro toprincipleofc#_datastructure_b_cs
Chapter1  intro toprincipleofc#_datastructure_b_csChapter1  intro toprincipleofc#_datastructure_b_cs
Chapter1 intro toprincipleofc#_datastructure_b_cs
 
Chapter 0: introduction to data structure
Chapter 0: introduction to data structureChapter 0: introduction to data structure
Chapter 0: introduction to data structure
 
3 classification
3  classification3  classification
3 classification
 
5 programming-using-java intro-tooop20102011
5 programming-using-java intro-tooop201020115 programming-using-java intro-tooop20102011
5 programming-using-java intro-tooop20102011
 
3 programming-using-java introduction-to computer
3 programming-using-java introduction-to computer3 programming-using-java introduction-to computer
3 programming-using-java introduction-to computer
 
1 programming-using-java -introduction
1 programming-using-java -introduction1 programming-using-java -introduction
1 programming-using-java -introduction
 
تلخيص النصوص تلقائيا
تلخيص النصوص تلقائياتلخيص النصوص تلقائيا
تلخيص النصوص تلقائيا
 
4×4×4 لتحصيل التميز
4×4×4 لتحصيل التميز4×4×4 لتحصيل التميز
4×4×4 لتحصيل التميز
 
Data preparation and processing chapter 2
Data preparation and processing chapter  2Data preparation and processing chapter  2
Data preparation and processing chapter 2
 
Introduction to-data-mining chapter 1
Introduction to-data-mining  chapter 1Introduction to-data-mining  chapter 1
Introduction to-data-mining chapter 1
 
Graph-Based Technique for Extracting Keyphrases In a Single-Document (GTEK)
Graph-Based Technique for Extracting Keyphrases In a Single-Document (GTEK)Graph-Based Technique for Extracting Keyphrases In a Single-Document (GTEK)
Graph-Based Technique for Extracting Keyphrases In a Single-Document (GTEK)
 

Recently uploaded

QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lessonQUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
httgc7rh9c
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
AnaAcapella
 

Recently uploaded (20)

Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
PANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxPANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptx
 
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lessonQUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
 
Our Environment Class 10 Science Notes pdf
Our Environment Class 10 Science Notes pdfOur Environment Class 10 Science Notes pdf
Our Environment Class 10 Science Notes pdf
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Introduction to TechSoup’s Digital Marketing Services and Use Cases
Introduction to TechSoup’s Digital Marketing  Services and Use CasesIntroduction to TechSoup’s Digital Marketing  Services and Use Cases
Introduction to TechSoup’s Digital Marketing Services and Use Cases
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Economic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food AdditivesEconomic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food Additives
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 

6 programming-using-java decision-making20102011-

  • 1. Using Java MINISTRY OF EDUCATION & HIGHER EDUCATION COLLEGE OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE Lecture 6 Decision Making : Equality and Relational Operators
  • 2.  What is the decision ?  Equality and relational operators.  Precedence and associatively of operations  How to use if ?  Practice  Be care  Emank X Mezank 2Presented & Prepared by: Mahmoud R. Alfarra
  • 3.  For example, the condition "grade is greater than or equal to 60" determines whether a student passed a test. 3Presented & Prepared by: Mahmoud R. Alfarra What is the decision ? Note 5 applications demand the making decision HW 5.1
  • 4.  Conditions in if statements can be formed by using the equality operators and relational operators.  Equality operators are used to check if two operands are equals or not.  Relational operators are used to check if one of two operands are greater or less than another. 4Presented & Prepared by: Mahmoud R. Alfarra Equality and relational operators
  • 5. 5Presented & Prepared by: Mahmoud R. Alfarra Equality and relational operators
  • 6. 6Presented & Prepared by: Mahmoud R. Alfarra Precedence and associatively of operations
  • 7. 7Presented & Prepared by: Mahmoud R. Alfarra How to use if ? If (condition) { /*Tasks will be executed * if the condition true*/ } condition yesNo If true Executed at all
  • 8.  Write a program to compare two numbers and print the larger, smaller, equal or not. 8Presented & Prepared by: Mahmoud R. Alfarra Example: Compare Integers Write a program to calculate the summation, multiple, division, subtraction and then compare the results to print the larger, smaller, equal or notHW 5.2
  • 9. 9Presented & Prepared by: Mahmoud R. Alfarra Example: Compare Integers Rewrite this program using another values HW 5.3
  • 10. 10Presented & Prepared by: Mahmoud R. Alfarra Forgetting the left and/or right parentheses for the condition in an if statement is a syntax error the parentheses are required. Confusing the equality operator, ==, with the assignment operator, =, can cause a logic error or a syntax error. It is a syntax error if the operators ==, !=, >= and <= contain spaces between their symbols, as in = =, ! =, > = and < =, respectively. Reversing the operators !=, >= and <=, as in =!, => and =<, is a syntax error.
  • 11. ‫تعاىل‬ ‫هللا‬ ‫قال‬: (‫املنفوش‬ ‫كالعهن‬‫اجلبال‬ ‫تكون‬ ‫يوم‬) 11Presented & Prepared by: Mahmoud R. Alfarra
  • 12. If … else & The family  12Presented & Prepared by: Mahmoud R. Alfarra