SlideShare a Scribd company logo
Using Java
MINISTRY OF EDUCATION & HIGHER EDUCATION
COLLEGE OF SCIENCE AND TECHNOLOGY
KHANYOUNIS- PALESTINE
Lecture 8
Decision Making
Practices
Identify and correct the errors in each of the
following sets of code:
 if ( gender == 1 )
System.out.println( "Woman" );
else;
System.out.println( "Man" );
 while ( z >= 0 )
sum += z;
2Presented & Prepared by: Mahmoud R. Alfarra
Practice 1
Identify and correct the errors in each of the
following sets of code:
 if ( age >= 65 );
System.out.println( "Age greater than or equal to 65" );
else
System.out.println( "Age is less than 65 )";
 int x = 1, total;
while ( x <= 10 ){
total += x;
++x; }
3Presented & Prepared by: Mahmoud R. Alfarra
Practice 1
Identify and correct the errors in each of the
following sets of code:
 while ( x <= 100 )
total += x;
++x;
 while ( y > 0 )
{
System.out.println( y );
++y; }
4Presented & Prepared by: Mahmoud R. Alfarra
Practice 1
Trace the following program, assuming x =5, y = 8
and x=8, y=5:
5Presented & Prepared by: Mahmoud R. Alfarra
Practice 2
Determine the output for each of the given sets of
code when x is 9 and y is 11 and when x is 11 and y is 9.
6Presented & Prepared by: Mahmoud R. Alfarra
Practice 2
Determine the output for each of the given sets of
code when x is 9 and y is 11 and when x is 11 and y is 9.
7Presented & Prepared by: Mahmoud R. Alfarra
Practice 2
‫العزة‬ ‫رب‬ ‫يقول‬(‫ـه‬‫ن‬‫سبحا‬)
(َ‫ل‬‫ا‬ ‫ـ‬َ‫ك‬ِّ‫ب‬َ‫ر‬ ‫اسم‬ ِّ‫ـح‬ِّ‫ب‬َ‫س‬‫ـى‬َ‫ل‬‫ـ‬ْ‫ع‬)
8Presented & Prepared by: Mahmoud R. Alfarra
Practices
9Presented & Prepared by: Mahmoud R. Alfarra

More Related Content

PPT
Computer Programming, Loops using Java - part 2
PPT
Computer Programming, Loops using Java
PPT
2 programming-using-java how to built application
PPT
7 programming-using-java decision-making220102011
PPT
6 programming-using-java decision-making20102011-
PPT
Tcs nqt 2019 p 2
PPT
Tcs nqt 2019 p 1
PDF
PF LAB ASSIGNMENT
Computer Programming, Loops using Java - part 2
Computer Programming, Loops using Java
2 programming-using-java how to built application
7 programming-using-java decision-making220102011
6 programming-using-java decision-making20102011-
Tcs nqt 2019 p 2
Tcs nqt 2019 p 1
PF LAB ASSIGNMENT

What's hot (11)

DOCX
Cis 355 i lab 2 of 6
DOCX
Cis 355 ilab 2 of 6
PDF
#OSSPARIS19: Introduction to scikit-learn - Olivier Grisel, Inria
PDF
Cp manual final
PPTX
Data structures Lecture no. 4
PDF
Algorithm
PPT
Class 9 Lecture Notes
DOC
Cis355 a ilab 2 control structures and user defined methods devry university
PDF
Algorithm defination, design & Implementation
PDF
175035 cse lab-05
PPTX
Introduction to computer_lec_04_fall_2018
Cis 355 i lab 2 of 6
Cis 355 ilab 2 of 6
#OSSPARIS19: Introduction to scikit-learn - Olivier Grisel, Inria
Cp manual final
Data structures Lecture no. 4
Algorithm
Class 9 Lecture Notes
Cis355 a ilab 2 control structures and user defined methods devry university
Algorithm defination, design & Implementation
175035 cse lab-05
Introduction to computer_lec_04_fall_2018
Ad

Similar to 8 programming-using-java decision-making practices 20102011 (7)

PPTX
20170415 當julia遇上資料科學
PPTX
20171127 當julia遇上資料科學
PDF
175035 cse lab-03
PPT
Selection Control Structures
PPTX
JPC#8 Introduction to Java Programming
PPTX
Introduction to Julia
PPT
Decisions in C or If condition
20170415 當julia遇上資料科學
20171127 當julia遇上資料科學
175035 cse lab-03
Selection Control Structures
JPC#8 Introduction to Java Programming
Introduction to Julia
Decisions in C or If condition
Ad

More from Mahmoud Alfarra (20)

PPT
Chapter 10: hashing data structure
PPT
Chapter9 graph data structure
PPT
Chapter 8: tree data structure
PPT
Chapter 7: Queue data structure
PPT
Chapter 6: stack data structure
PPT
Chapter 5: linked list data structure
PPT
Chapter 4: basic search algorithms data structure
PPT
Chapter 3: basic sorting algorithms data structure
PPT
Chapter 2: array and array list data structure
PPT
Chapter1 intro toprincipleofc#_datastructure_b_cs
PPT
Chapter 0: introduction to data structure
PPTX
3 classification
PPT
5 programming-using-java intro-tooop20102011
PPT
4 programming-using-java intro-tojava20102011
PPT
3 programming-using-java introduction-to computer
PPT
1 programming-using-java -introduction
PPTX
تلخيص النصوص تلقائيا
PDF
4×4×4 لتحصيل التميز
PPTX
Data preparation and processing chapter 2
PPTX
Introduction to-data-mining chapter 1
Chapter 10: hashing data structure
Chapter9 graph data structure
Chapter 8: tree data structure
Chapter 7: Queue data structure
Chapter 6: stack data structure
Chapter 5: linked list data structure
Chapter 4: basic search algorithms data structure
Chapter 3: basic sorting algorithms data structure
Chapter 2: array and array list data structure
Chapter1 intro toprincipleofc#_datastructure_b_cs
Chapter 0: introduction to data structure
3 classification
5 programming-using-java intro-tooop20102011
4 programming-using-java intro-tojava20102011
3 programming-using-java introduction-to computer
1 programming-using-java -introduction
تلخيص النصوص تلقائيا
4×4×4 لتحصيل التميز
Data preparation and processing chapter 2
Introduction to-data-mining chapter 1

Recently uploaded (20)

PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
Cardiovascular Pharmacology for pharmacy students.pptx
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
Pharma ospi slides which help in ospi learning
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
NOI Hackathon - Summer Edition - GreenThumber.pptx
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PPTX
UNDER FIVE CLINICS OR WELL BABY CLINICS.pptx
PDF
English Language Teaching from Post-.pdf
DOCX
UPPER GASTRO INTESTINAL DISORDER.docx
PDF
From loneliness to social connection charting
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
Revamp in MTO Odoo 18 Inventory - Odoo Slides
PPTX
Open Quiz Monsoon Mind Game Prelims.pptx
PPTX
Cell Structure & Organelles in detailed.
PDF
Insiders guide to clinical Medicine.pdf
PDF
PSYCHOLOGY IN EDUCATION.pdf ( nice pdf ...)
102 student loan defaulters named and shamed – Is someone you know on the list?
Cardiovascular Pharmacology for pharmacy students.pptx
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Pharma ospi slides which help in ospi learning
Abdominal Access Techniques with Prof. Dr. R K Mishra
NOI Hackathon - Summer Edition - GreenThumber.pptx
O5-L3 Freight Transport Ops (International) V1.pdf
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
UNDER FIVE CLINICS OR WELL BABY CLINICS.pptx
English Language Teaching from Post-.pdf
UPPER GASTRO INTESTINAL DISORDER.docx
From loneliness to social connection charting
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Revamp in MTO Odoo 18 Inventory - Odoo Slides
Open Quiz Monsoon Mind Game Prelims.pptx
Cell Structure & Organelles in detailed.
Insiders guide to clinical Medicine.pdf
PSYCHOLOGY IN EDUCATION.pdf ( nice pdf ...)

8 programming-using-java decision-making practices 20102011

  • 1. Using Java MINISTRY OF EDUCATION & HIGHER EDUCATION COLLEGE OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE Lecture 8 Decision Making Practices
  • 2. Identify and correct the errors in each of the following sets of code:  if ( gender == 1 ) System.out.println( "Woman" ); else; System.out.println( "Man" );  while ( z >= 0 ) sum += z; 2Presented & Prepared by: Mahmoud R. Alfarra Practice 1
  • 3. Identify and correct the errors in each of the following sets of code:  if ( age >= 65 ); System.out.println( "Age greater than or equal to 65" ); else System.out.println( "Age is less than 65 )";  int x = 1, total; while ( x <= 10 ){ total += x; ++x; } 3Presented & Prepared by: Mahmoud R. Alfarra Practice 1
  • 4. Identify and correct the errors in each of the following sets of code:  while ( x <= 100 ) total += x; ++x;  while ( y > 0 ) { System.out.println( y ); ++y; } 4Presented & Prepared by: Mahmoud R. Alfarra Practice 1
  • 5. Trace the following program, assuming x =5, y = 8 and x=8, y=5: 5Presented & Prepared by: Mahmoud R. Alfarra Practice 2
  • 6. Determine the output for each of the given sets of code when x is 9 and y is 11 and when x is 11 and y is 9. 6Presented & Prepared by: Mahmoud R. Alfarra Practice 2
  • 7. Determine the output for each of the given sets of code when x is 9 and y is 11 and when x is 11 and y is 9. 7Presented & Prepared by: Mahmoud R. Alfarra Practice 2
  • 8. ‫العزة‬ ‫رب‬ ‫يقول‬(‫ـه‬‫ن‬‫سبحا‬) (َ‫ل‬‫ا‬ ‫ـ‬َ‫ك‬ِّ‫ب‬َ‫ر‬ ‫اسم‬ ِّ‫ـح‬ِّ‫ب‬َ‫س‬‫ـى‬َ‫ل‬‫ـ‬ْ‫ع‬) 8Presented & Prepared by: Mahmoud R. Alfarra
  • 9. Practices 9Presented & Prepared by: Mahmoud R. Alfarra