You are on page 1of 78

Plan Training Session

Data Gathering Instrument for Trainees Characteristics


Please answer the following instrument according to the characteristics described below. Encircle the letter of your choice that best describes you as a learner. Blank spaces are provided for some data that need your response.
Characteristics of learners Language, literacy and numeracy (LL&N) Average grade in: English Average grade in: Math

a. 95 and above b. 90 to 94 c. 85 to 89 d. 80 to 84
a. 75 to 79 Cultural and language background Ethnicity/culture:

a. 95 and above b. 90 to 94 c. 85 to 89 d. 80 to 84 e. 75 to 79

a. Ifugao b. Igorot c. Ibanag d. Gaddang e. Muslim f. Ibaloy g. Others( please specify)_____________


Highest Educational Attainment:

Education & general knowledge

a. High School Level b. High School Graduate c. College Level d. College Graduate e. with units in Masters degree f. Masteral Graduate g. With units in Doctoral Level h. Doctoral Graduate

Sex

a. Male
b. Female Your age: _____ 1. 2. a. b. c. d. e. Disabilities(if any)_____________________ Existing Health Conditions (Existing illness if any) None Asthma Heart disease Anemia Hypertension

Age Physical ability

Characteristics of learners f. Diabetes g. Others(please specify) ___________________ Certificates a. Microsoft Certified Professional b. Java Certified Programmer Number of years as a programmer ______ List down trainings related to Software Development ___________________________ ___________________________ ___________________________ National Certificates acquired and NC level ___________________________ ___________________________ Other courses related to Software Development a. Units in education b. Masters degree units in education c. Others(please specify) _________________________ a. Visual - The visual learner takes mental pictures of information given, so in order for this kind of learner to retain information, oral or written, presentations of new information must contain diagrams and drawings, preferably in color. The visual learner can't concentrate with a lot of activity around him and will focus better and learn faster in a quiet study environment. b. Kinesthetic - described as the students in the classroom, who have problems sitting still and who often bounce their legs while tapping their fingers on the desks. They are often referred to as hyperactive students with concentration issues. c. Auditory- a learner who has the ability to remember speeches and lectures in detail but has a hard time with written text. Having to read long texts is pointless and will not be retained by the auditory learner unless it is read aloud. d. Activist - Learns by having a go e. Reflector - Learns most from activities where they can watch, listen and then review what has happened. f. Theorist - Learns most when ideas are linked to existing theories and concepts. g. Pragmatist - Learns most from learning activities that are directly relevant to their situation. a. Financially challenged b. Working student c. Solo parent d. Others(please specify) ___________________________

Previous experience with the topic

Previous learning experience

Training Level completed Special courses

Learning styles

Other needs

Multiple Intelligences Survey


1999 Walter McKenzie, The One and Only Surfaquarium http://surfaquarium.com/MI/inventory.htm

Part I Complete each section by placing a 1 next to each statement you feel accurately describes you. If you do not identify with a statement, leave the space provided blank. Then total the column in each section. Section 1 1_____ I enjoy categorizing things by common traits _____ Ecological issues are important to me 1_____ Hiking and camping are enjoyable activities _____ I enjoy working on a garden 1_____ I believe preserving our National Parks is important 1_____ Putting things in hierarchies makes sense to me _____ Animals are important in my life _____ My home has a recycling system in place _____ I enjoy studying biology, botany and/or zoology 1_____ I spend a great deal of time outdoors 5_____ TOTAL for Section 1 Section 2 1_____ I easily pick up on patterns 1_____ I focus in on noise and sounds 1_____ Moving to a beat is easy for me _____ Ive always been interested in playing an instrument _____ The cadence of poetry intrigues me 1_____ I remember things by putting them in a rhyme 1_____ Concentration is difficult while listening to a radio or television 1_____ I enjoy many kinds of music _____ Musicals are more interesting than dramatic plays _____ Remembering song lyrics is easy for me 6_____ TOTAL for Section 2 Section 3 1_____ I keep my things neat and orderly 1_____ Step-by-step directions are a big help 1_____ Solving problems comes easily to me 1_____ I get easily frustrated with disorganized people 1_____ I can complete calculations quickly in my head 1_____ Puzzles requiring reasoning are fun 1_____ I cant begin an assignment until all my questions are answered 1_____ Structure helps me be successful 1_____ I find working on a computer spreadsheet or database rewarding 1_____ Things have to make sense to me or I am dissatisfied 10_____ TOTAL for Section 3

Section 4 1_____ It is important to see my role in the big picture of things 1_____ I enjoy discussing questions about life 1_____ Religion is important to me _____ I enjoy viewing art masterpieces 1_____ Relaxation and meditation exercises are rewarding 1_____ I like visiting breathtaking sites in nature _____ I enjoy reading ancient and modern philosophers 1_____ Learning new things is easier when I understand their value _____ I wonder if there are other forms of intelligent life in the universe _____ Studying history and ancient culture helps give me perspective 6_____ TOTAL for Section 4 Section 5 1_____ I learn best interacting with others 1_____ The more the merrier 1_____ Study groups are very productive for me _____ I enjoy chat rooms _____ Participating in politics is important _____ Television and radio talk shows are enjoyable 1_____ I am a team player 1_____ I dislike working alone 1_____ Clubs and extracurricular activities are fun _____ I pay attention to social issues and causes 6_____ TOTAL for Section 5 Section 6 _____ I enjoy making things with my hands _____ Sitting still for long periods of time is difficult for me 1_____ I enjoy outdoor games and sports _____ I value non-verbal communication such as sign language 1_____ A fit body is important for a fit mind _____ Arts and crafts are enjoyable pastimes 1_____ Expression through dance is beautiful 1_____ I like working with tools 1_____ I live an active lifestyle 1_____ I learn by doing 6_____ TOTAL for Section 6

Section 7 _____ I enjoy reading all kinds of materials 1_____ Taking notes helps me remember and understand _____ I faithfully contact friends through letters and/or e-mail _____ It is easy for me to explain my ideas to others _____ I keep a journal _____ Word puzzles like crosswords and jumbles are fun _____ I write for pleasure _____ I enjoy playing with words like puns, anagrams and spoonerisms _____ Foreign languages interest me _____ Debates and public speaking are activities I like to participate in 1_____ TOTAL for Section 7 Section 8 1_____ I am keenly aware of my moral beliefs 1_____ I learn best when I have an emotional attachment to the subject 1_____ Fairness is important to me 1_____ My attitude effects how I learn _____ Social justice issues concern me 1_____ Working alone can be just as productive as working in a group 1_____ I need to know why I should do something before I agree to do it 1_____ When I believe in something I will give 100% effort to it 1_____ I like to be involved in causes that help others _____ I am willing to protest or sign a petition to right a wrong 8_____ TOTAL for Section 8 Section 9 1_____ I can imagine ideas in my mind 1_____ Rearranging a room is fun for me 1_____ I enjoy creating art using varied media 1_____ I remember well using graphic organizers _____ Performance art can be very gratifying 1_____ Spreadsheets are great for making charts, graphs and tables 1_____ Three dimensional puzzles bring me much enjoyment 1_____ Music videos are very stimulating 1_____ I can recall things in mental pictures _____ I am good at reading maps and blueprints 8_____ TOTAL for Section 9

Part II Now carry forward your total from each section and multiply by 10 below: Section Total Multiply Score Forward 1 5 x 10 50 2 6 x 10 60 3 10 x 10 100 4 6 x 10 60 5 6 x 10 60 6 6 x 10 60 7 1 x 10 10 8 8 x 10 80 9 8 x 10 80 Part III Now plot your scores on the bar graph provided: 100 100 90 80 70 60 60 60 60 60 50 50 40 30 20 10 Sec Sec Sec Sec Sec Sec 0 1 2 3 4 5 6 Part IV Now determine your intelligence profile! Key: Section Section Section Section Section Section Section Section Section 1 2 3 4 5 6 7 8 9 This This This This This This This This This reflects your Naturalist strength suggests your Musical strength indicates your Logical strength illustrates your Existential strength shows your Interpersonal strength tells your Kinesthetic strength indicates your Verbal strength reflects your Intrapersonal strength suggests your Visual strength

80

80

10 Sec 7

Sec 8

Sec 9

Remember: Everyone has all the intelligences! You can strengthen an intelligence! This inventory is meant as a snapshot in time it can change! M.I. is meant to empower, not label people!
1999 Walter McKenzie, The One and Only Surfaquarium http://surfaquarium.com This survey may be printed, used and/or modified by educators as long as the copyright tag remains intact.

FORM 1.1 SELF-ASSESSMENT CHECK

INSTRUCTIONS: This Self-Check Instrument will give the trainer necessary data or information which is essential in planning training sessions. Please check the appropriate box of your answer to the questions below. CORE COMPETENCIES CAN I?
1. Design program logic

YES

NO

1.1 Select program logic design approach? 1.2 Document the program logic design? 1.3 Validate the design?
2. Apply program development approach?

2.1 Determine and select appropriate program development approach?

2.2
3.

Apply the selected development approach?

Apply object-oriented program language skills


3.1 Apply basic language syntax and layout? 3.2 Apply basic OO principles in the target language? 3.3 Debug code? 3.4 Document Activities? 3.5 Test code?

4. Apply programming skills in a second language?

3.1 Apply basic language syntax and layout? 3.2 Code using standard algorithms? 3.3 Debug code? 3.4 Document activities?

CORE COMPETENCIES CAN I? 3.5 Test code? YES NO

Note: In making the Self-Check for your Qualification, all required

competencies should be specified. It is therefore required of a Trainer to

be well- versed of the CBC or TR of the program qualification he is teaching.

Evidences/Proof of Current Competencies

Form 1.2: Evidence of Current Competencies acquired related to Job/Occupation

Current competencies Design Program Logic

Proof/Evidence Certificate of Achievement / Recognition (from IT related courses/programs/trainings) Certificate of Employment (with IT related positions)

Means of validating Contact previous employer verify the authenticity of the document


Apply Program Development Approach Apply Programming Skills in Second Language

Programmers System developers System engineers System analyst System designer Encoder Others please specify: ___________
Contact previous employer to verify the authenticity of the document Authenticated Certificate of Competency

Certificate of Employment (with IT related positions) Certificate of Competency Develop Application Using Object-Oriented Programming Language (COC 1) Certificate of Recognition (Awarded by a company for the development and implementation of a Software Application) Certificate of Employment (with IT related positions)

Contact listed company/organization to verify the authenticity of the document

Programmers System developers System engineers System analyst System designer Encoder Others please specify: ___________

Contact listed company/organization to verify the authenticity of the document

Identifying Training Gaps From the accomplished Self-Assessment Check (Form 1.1) and the evidences of current competencies (Form 1.2), the Trainer will be able to identify what the training needs of the prospective trainee are.

Form 1.3 Summaries of Current Competencies versus Required Competencies

Required Units of Competency/Learning Outcomes based on CBC

Current Competencies

Training Gaps/Requirements

1. Design Program Logic 1.1 1.2 Select the program logic design approach Document the program logic or design Validate the design
Select the program logic design approach Document the program logic or design Validate the design

1.3

2. Apply Program Development Approach

2.1

Determine and select appropriate program development approach. Apply the selected development approach

Determine and select appropriate program development approach. Apply the selected development approach

2.2

3. Apply Object-Oriented Program Language Skills

3.1 3.2

Apply basic language syntax and layout Apply basic OO principles in the target language Debug code Document activities Test code

Apply basic language syntax and layout Apply basic OO principles in the target language Debug code Document activities Test code

3.3 3.4 3.5

4. Apply Programming Skills In A Second Language


4.1 Apply basic language syntax and layout Apply basic language syntax and layout Code using standard algorithms Debug Code

4.2 Code using standard algorithms 4.3 Debug Code

4.4 4.5

Document Activities Test Code

Document Activities Test Code

Using Form No.1.4, convert the Training Gaps into a Training Needs/ Requirements. Refer to the CBC in identifying the Module Title or Unit of Competency of the training needs identified. Form No. 1.4: Training Needs
Training Needs (Learning Outcomes) Apply basic language syntax and layout Apply basic OO principles in the target language Debug code Document activities Test code Module Title/Module of Instruction 1. Apply Object-Oriented Program Language Skills

Session Plan

Sector Qualification Title Module Learning Outcomes:

: : :

Information and Communications Technology (ICT) Sector Programming NC IV Apply Object-Oriented Program Language Skills using JAVA Programming Language Applying Object-Oriented Program Language Skills using JAVA Programming Language

Unit of Competency :

1. Apply basic language syntax and layout 2. Apply basic OO principles in the target language (JAVA) 3. Debug JAVA Codes 4. Document Activities 5. Test JAVA Codes

A. Introduction This unit of competency covers the knowledge, skills and attitudes in programming tasks using an object oriented programming language competence includes tool usage, documentation, debugging and testing techniques in support of the programming activities B. Learning Activities LO 1: Apply basic language syntax and layout Learning Content Semantics and Syntax Methods Modular selfpaced Modular selfpaced Practice Presentation Read Information Sheet 3.1-1 Read Information Sheet 3.1-2 Practice Answer Self-Check 3.1-1 Answer Self-Check 3.1-2 Perform Task Sheet 3.1-2 Feedback Compare answers to Answer Key 3.11 Compare answers to Answer Key 3.12 Evaluate your work using Performance Criteria Resources CBLM Time 1 HR

Elements of a JAVA Programming Language

CBLM

6 HRS

Computer Package w/ Java Program Installed,

Checklist 3.1-2 Control Statements in JAVA Programming Language Modular selfpaced Practice Read Information Sheet 3.1-3 Answer Self-Check 3.1-3 Perform Task Sheet 3.1-3 Compare answers to Answer Key 3.13 Evaluate your work using Performance Criteria Checklist 3.1-3 Compare answers to Answer Key 3.14 Evaluate your work using Performance Criteria Checklist 3.1-4

Project Sheet 3.12 CBLM 15 HRS

Computer Package w/ Java Program Installed, Project Sheet 3.13 CBLM 3 HRS

Arrays in JAVA Programming Language

Modular selfpaced Practice

Read Information Sheet 3.1-4

Answer Self-Check 3.1-4 Perform Task Sheet 3.1-4

Computer Package w/ Java Program Installed, Project Sheet 3.14 Resources CBLM CBLM Computer Package w/ Java Program Installed, Project Sheet 3.22 CBLM Computer Package w/ Java Program Installed, 2 HRS Time 1 HR 2 HRS

LO 2: Apply basic OO principles in the target language (JAVA) Learning Content Methods Presentation Principles of Object-Oriented Programming Language Apply principle of Encapsulation on JAVA Programs Modular selfpaced Modular selfpaced Practice Read information sheet 3.2-1 Read information sheet 3.2-2

Practice Answer selfcheck 3.2-1 Answer selfcheck 3.2-2 Perform Task Sheet 3.2-2

Feedback Comparer to answer key 3.2-1 Comparer to answer key 3.2-2 Evaluate your work using Performance Criteria Checklist 3.2-2 Comparer to answer key 3.2-3 Evaluate your work using Performance

Apply principle of Inheritance on JAVA Programs

Modular selfpaced Practice

Read information sheet 3.2-3

Answer selfcheck 3.2-3 Perform Task Sheet 3.2-3

Criteria Checklist 3.2-3 Apply principle of Polymorphism on JAVA Programs Modular selfpaced Practice Read information sheet 3.2-4 Answer selfcheck 3.2-4 Perform Task Sheet 3.2-4 Comparer to answer key 3.2-4 Evaluate your work using Performance Criteria Checklist 3.2-4 Comparer to answer key 3.2-5 Evaluate your work using Performance Criteria Checklist 3.2-5

Project Sheet 3.23 CBLM Computer Package w/ Java Program Installed, Project Sheet 3.22 CBLM Computer Package w/ Java Program Installed, Project Sheet 3.22 2 HRS 2 HRS

Use Forms in JAVA

Modular selfpaced Practice

Read information sheet 3.2-5

Answer selfcheck 3.2-5 Perform Task Sheet 3.2-5

LO 3: Debug Code Learning Content Errors Handling Methods Modular selfpaced Practice Presentation Read information sheet 3.3-1 Practice Answer selfcheck 3.3-1 Perform Task Sheet 3.3-1 Feedback Comparer to answer key 3.3-1 Evaluate your work using Performance Criteria Checklist 3.3-1 Comparer to answer key 3.3-2 Evaluate your work using Performance Criteria Checklist 3.3-2 Comparer to answer key 3.3-3 Resources CBLM Computer Package w/ Java Program Installed, Project Sheet 3.31 CBLM Computer Package w/ Java Program Installed, Project Sheet 3.32 CBLM 1 HR 1 HR Time 1 HR

Debugging Options

Modular selfpaced Practice

Read information sheet 3.3-2

Answer selfcheck 3.3-2 Perform Task Sheet 3.3-2

Procedures in debugging and editing the program

Modular selfpaced

Read information sheet 3.3-3

Answer selfcheck 3.3-3

Compiling the Program LO 4: Document Activities Learning Content Documentation Techniques Program and Documentation Standards

Modular selfpaced

Read information sheet 3.3-4

Answer selfcheck 3.3-4

Comparer to answer key 3.3-4

CBLM

1 HR

Methods Modular selfpaced Modular selfpaced Practice

Presentation Read information sheet 3.4-1 Read information sheet 3.4-2

Practice Answer selfcheck 3.4-1 Answer selfcheck 3.4-2 Perform Task Sheet 3.4-2

Feedback Comparer to answer key 3.4-1 Comparer to answer key 3.4-2 Evaluate your work using Performance Criteria Checklist 3.4-2 Comparer to answer key 3.4-3 Evaluate your work using Performance Criteria Checklist 3.4-3

Resources CBLM CBLM Computer Package w/ Java Program Installed, Project Sheet 3.42 CBLM

Time 1 HR 1 HR

Internal Documentation Techniques

Modular selfpaced Practice

Read information sheet 3.4-3

Answer selfcheck 3.4-3 Perform Task Sheet 3.4-3

1 HR

Computer Package w/ Java Program Installed, Project Sheet 3.43

LO 5: Test Code Learning Content Testing Techniques Methods Modular selfpaced Practice Presentation Read information sheet 3.5-1 Practice Answer selfcheck 3.5-1 Perform Task Sheet 3.4-1 Feedback Comparer to answer key 3.5-1 Evaluate your work using Performance Criteria Checklist 3.5-1 Comparer to answer key 3.5-2 Resources CBLM Computer Package w/ Java Program Installed, Project Sheet 3.51 CBLM 1 HR Time 1 HR

Program and Documentation Standards

Modular selfpaced

Read information sheet 3.5-2

Answer selfcheck 3.5-2

User Manual Printing Documents of the Programs C. Assessment Plan Written Test: Performance Test:

Modular selfpaced Modular selfpaced

Read information sheet 3.5-3 Read information sheet 3.5-4

Answer selfcheck 3.5-3 Answer selfcheck 3.5-4

Comparer to answer key 3.5-3 Comparer to answer key 3.5-4

CBLM CBLM

1 HR 1 HR

D. Teachers Self-Reflection of the Session

PARTS OF A COMPETENCY-BASED LEARNING MATERIAL PACKAGE References/Further Reading Performance Criteria Checklist Operation/Task/Job Sheet Self Check Answer Key

Self Check
Information Sheet Learning Experiences
Learning Outcome Summary

Module Content Module Content ModuleCompetencies List of Content Module Content

Module Content Front Page

In our efforts to standardize CBLM, the above parts are recommended for use in Competency Based Training (CBT) in Technical Education and Skills Development Authority (TESDA) Technology Institutions. The next sections will show you the components and features of each part.

PROGRAMMING NC IV
COMPETENCY-BASED LEARNING MATERIALS (CBLM)

List of Competencies
No. 1. 2. Unit of Competency Design Program Logic Apply Program Development Approach Module Title Designing Program Logic Applying Program Development Approach Code
CECSD01 CECSD02

3.

Apply Object-Oriented Applying ObjectProgram Language Oriented Program Skills Language Skills Apply Programming Skills in a Second Language Applying Programming Skills in a Second Language

CECSD03

4.

CECSD04

MODULE CONTENT

UNIT OF COMPETENCY :

APPLY OBJECT-ORIENTED PROGRAM LANGUAGE SKILLS

MODULE TITLE

APPLYING OBJECT-ORIENTED PROGRAM LANGUAGE SKILLS

MODULE DESCRIPTOR

This module defines the competency required to undertake programming tasks using an object oriented programming language competence includes tool usage, documentation, debugging and testing techniques in support of the programming activities

NOMINAL DURATION

54 hours

LEARNING OUTCOMES: At the end of this module you MUST be able to: LO 1. Apply basic language syntax and layout LO 2. Apply basic OO principles in the target language LO 3. Debug code LO 4. Document activities LO 5. Test code

ASSESSMENT CRITERIA 1. Observed basic language syntax rules and best practice based on program standard and structure. 2. Used language data types, operators and expressions based on program standard and structure. 3. Used appropriate language syntax for sequence, selection and iteration constructs based on program standard and structure. 4. Used Arrays and array objects based on program standard and structure. 5. Implemented a class that contains primitive member / instance variables based on program structure. 6. Implemented a class that contains multiple options for object construction based on program structure. 7. Defined aggregation in a class based on program structure. 8. Implemented inheritance to at least 2 levels of depth based on program structure.

9. Used polymorphism at a simple level through inheritance to enable easy code extension based on program structure.

10. Used particularly an integrated development environment and the language debugging facilities based on program structure.

11. Used program debugging techniques to detect and resolve errors based on program structure. 12. Followed the guidelines for developing maintainable code adhering to a set of coding standard. 13. Followed and used internal documentation standards and tools. 14. Designed a built-in application programs in accordance to systems and programming requirements and standards. 15. Developed and conducted simple test to confirm the coding process to meet design specification 16. Documented the tests performed based on program and documentation standard. 17. Made corrections to the code and documentation as needed.

LEARNING OUTCOME NO. 1 APPLY BASIC LANGUAGE SYNTAX AND LAYOUT

CONTENTS: 1. Semantics and Syntax 2. Elements of Programming 3. Program Control Structure 4. Arrays ASSESSMENT CRITERIA:
1. Observed basic language syntax rules and best practice based on program standard and structure. 2. Used language data types, operators and expressions based on program standard and structure. 3. Used appropriate language syntax for sequence, selection and iteration constructs based on program standard and structure. 4. Used Arrays and array objects based on program standard and structure.

CONDITIONS:
Trainees must be provided with the following:

1. WORKPLACE LOCATION 2. EQUIPMENT - Computer Package w/ Java Programming Language Installed - LCD 3. TOOLS, ACCESSORIES AND SUPPLIES - Whiteboard - CD Installers (OS, Java SDK, Java IDE) - Flash Drives 4. TRAINING RESOURCES - CBLMs - Whiteboard marker ASSESSMENT METHODS: Interview Written examinations Portfolio

Learning Experiences
Learning Outcome 1

APPLY BASIC LANGUAGE SYNTAX AND LAYOUT


Learning Activities Special Instructions

1. Read Information Sheet 3.1-1 on Syntax and Semantics 2. Answer Self-Check 3.1-1 Compare your answers with Answer Key 3.1-1

3. Read Information Sheet 3.1-2 on Elements of a Java Programming Go through the information sheets and do Language 4. Answer Self-Check 3.1-2 Compare your answers with Answer Key 3.1-2 5. Perform Task Sheet 3.1-2 Evaluate your work using Performance Criteria Checklist 3.1-2 6. Read Information Sheet 3.1-3 on Java Control Statements 7. Answer Self-Check 3.1-3 Compare your answers with Answer Key 3.1-3 8. Perform Task Sheet 3.1-3 Evaluate your work using Performance Criteria Checklist 3.1-3 9. Read Information Sheet 3.1- 4 on Arrays in Java 10. Answer Self-Check 3.1-4 Compare your answers with Answer Key 3.1-4

In this learning outcome you shall learn and understand the difference of Semantics and syntax, the basic programming tools and elements together with different forms of control structures. Some source code placed on specific information and answer self-checks to ensure that knowledge of the standards in procedural programming language.

The output of your practice of this learning outcome are the following:

1. Write, debug, compile and run Java program 2. Use Java programming elements a. Comments b. Datatypes c. Variables d. Input/Output 3. Use expressions and operators 4. Use Programming Control Structures. 5. Use Arrays and Arrays objects

Show your output to your trainer for his feedback.

Information Sheet 3.1-1 Syntax and Semantics


Learning Objectives: After reading this INFORMATION SHEET, YOU MUST be able to: 1. Describe syntax and semantics 2. Explain the relationship of syntax and semantics 3. Use basic language syntax rules based on the standard of Java Programming Language. Introduction Language provides a means of communication by sound and written symbols. Human beings learn language as a consequence of their life experiences, but in linguisticsthe science of languagesthe forms and leanings of languages are subjected to a more rigorous examination. This science can also be applied to the subject of this text, programming languages. In contrast to the natural languages, with which we communicate our thoughts and feelings, programming languages can be viewed as articial languages dened by men and women initially for the purpose of communicating with computers but, as importantly, for communicating algorithms among people. What is Syntax?

A set of strict grammar rules, symbols, and special words used to construct a computer program. Syntax is the grammar of the language, that is the rules for constructing valid statements in that language. If you break the rules the compiler will complain. The term syntax can also be used to refer to these rules themselves, as in the syntax of a language.

Syntax Error

Syntax errors may occur when an invalid equation is entered into a calculator. This can be caused by opening brackets without closing them, or less commonly, using several decimal points in one number. If a syntax error is encountered during compilation, it must be corrected if the source code is to be successfully compiled. GOOD compiler should help in identifying and locating errors. Any token which doesnt match grammar rule is part of syntax error i.e arithmetic expression with unbalance parenthesis.

Common errors in programming

Statements that do not end with semi-colon (;) Misspelled keywords or reserved words Undeclared identifiers

What is Semantic? Semantic is

Meaning of statement Compatibility of statement correct usage of statement Computers can't read your mind, so they don't help much if the meaning of your program is not what you wanted. In this regard, semantics permits programs to be separated into their syntactical part (grammatical structure) and their semantic part (meaning).

Example: If instead of X = 1; it were given as Y = 1; WHERE X was declared in program but Y was not

The following are examples of valid and invalid statements x * y = c; y = con; const int x : 10; int x = a Invalid, it should be c =x*y; Valid Invalid, it should be const int x = 10; Invalid, missing semicolon (;)

Note: Valid syntax and semantics will be included with the introduction of new keyword/reserved words

Self- Check 3.1-1


True or False Direction: Write T if the statement is correct and F if the statement is false. Write your answers on the space provided before each number ___1. Semantic is a set of strict grammar rules, symbols, and special words used to construct a computer program. ___2. Syntax is the speaking of the language, that is the rules for constructing valid statements in that language. ___3. If you break the rules the compiler will complain. ___4. The term semantic can also be used to refer to these rules themselves, as in the syntax of a language. ___5. If a syntax error is encountered during compilation (mapping high level language to low level language) it must be corrected if the source code is to be successfully compiled. ___6. Computers can read your mind, so they don't help much if the meaning of your program is not what you wanted. ___7. Syntax is the study of the rules that govern the structure of sentences, and which determine their relative grammaticality. ___8. Syntax errors may also occur when an invalid equation is entered into a calculator. This can be caused by opening brackets without closing them, or less commonly, using several decimal points in one number. ___9. GOOD compiler should help in identifying and locating errors.

ANSWER KEY 1.1 1. 2. 3. 4. 5. 6. 7. 8. 9. F F T F T F F T T

Information Sheet 3.1-2 Elements of a Java Programming Language


Learning Objectives: After reading this INFORMATION SHEET, YOU MUST be able to: 1. 2. 3. 4. Define the different programming elements in Java Enumerate the different program elements in Java Enumerate the different operators used in Java Use language data types, operators and expressions based on the standard of specific programming language.

The previous information sheet, you were introduced to the importance of following the correct syntax and understanding the different semantics of the every program code you are writing. In this information sheet, you will be introduced on the different elements of Java programming language which later will be used to create your Java program A JAVA program is made up of many elements. These elements are the building blocks of a Java program. Some of these elements are a MUST to run any Java program and there are some that can be made available if it is critical in satisfying specific program requirements. Proper use of the different syntax and understanding of their semantics are important to write, compile and run any Java program regardless of their provided functions.

Elements of a Java Program


Comments Comments are descriptions that are added to a program to make code easier to understand. The compiler ignores comments and hence its only for documentation of the program.

The Java programming language supports three kinds of comments:


In-line The compiler ignores everything from // to the end of the line. Example: int i=5; // Set the integer to 5 Multi-line The compiler ignores everything from /* to */. Example: /* Set the integer to 5 */ int i=5;

Documentation This indicates a documentation comment (doc comment, for short). The compiler ignores this kind of comment, just like it ignores comments that use /* and */. The JDK javadoc tool uses doc comments when preparing automatically generated documentation. Example: /** This applet tests graphics. */ public class testApplet extends applet{... or /** * Asterisks inside the comment are ignored by javadoc so they * can be used to make nice line markers. **/

Java Data and Variables There are 8 primitive data types. The names of the eight primitive data types are:
Byte Short int long float double char boolean

There are both integer and floating point primitive types. Integer types have no fractional part; floating point types have a fractional part. On paper, integers have no decimal point, and floating point types do. But in main memory, there are no decimal points: even floating point values are represented with bit patterns. There is a fundamental difference between the method used to represent integers and the method used to represent floating point numbers.
Integer Type byte short Int long Primitive Data Types Size Range 8 bits -128 to +127 16 bits -32,768 to +32,767 32 bits (about)-2 billion to +2 billion 64 bits (about)-10E18 to +10E18

Floating Point Primitive Data Types Type Size Range float 32 bits -3.4E+38 to +3.4E+38 double 64 bits -1.7E+308 to 1.7E+308

Examples int yr = 2006; double rats = 8912 ;

For each primitive type, there is a corresponding wrapper class. A wrapper class can be used to convert a primitive data value into an object, and some type of objects into primitive data. The table shows primitive types and their wrapper classes: primitive type Wrapper type Byte Short Int Long Float Double Char Boolean Byte Short Int Long Float Double Character Boolean

Variables only exist within the structure in which they are defined. For example, if a variable is created within a method, it cannot be accessed outside the method. In addition, a different method can create a variable of the same name which will not conflict with the other variable. A java variable can be thought of as a little box made up of one or more bytes that can hold a value of a particular data type: Syntax: variabletype variablename = data; Source Code 2.1 ( demonstrating declaration of a variable )
public class Example { public static void main(String[]args){ long x = 123; //a declaration of a variable named //x with datatype long System.out.println("The variable x has: " + x); } }

Sample Run The variable x has 123

public class MaxDemo { public static void main(String[]args) { //integers byte largestByte = Byte.MAX_VALUE; short largestShort = Short.MAX_VALUE; int largestInteger = Integer.MAX_VALUE; long largestLong = Long.MAX_VALUE; //real numbers float largestFloat = Float.MAX_VALUE; double largestDouble = Double.MAX_VALUE; //other primitive datatypes char aChar = ''; boolean = aBoolean = true; //Display them all System.out.println("largest byte value is " + largestByte); System.out.println("largest short value is " + largestShort); System.out.println("largest integer is " + largestInteger); System.out.println("largest long is " + largestLong); System.out.println("largest float is " + largestFloat); System.out.println("largest double is " + largestDouble); } }

Sample Run The largest byte value is 127. The largest short value is 32767. The largest integer value is 2147483647. The largest long value is 9223372036854775807. The largest float value is 3.4028235E38. The largest double value is 1.7976931348623157E308.

Java Arithmetic Operators The Java programming language has includes five simple arithmetic operators like are + (addition), - (subtraction), * (multiplication), / (division), and % (modulo). The following table summarizes the binary arithmetic operators in the Java programming language.

The relation operators in Java are: ==, !=, <, >, <=, and >=. The meanings of these operators are: Use Returns true if op1 added to op2 op2 subtracted from op1 op1 multiplied with op2 op1 divided by op2 Computes the remainder of dividing op1 by op2

op1 + op2 op1 - op2 op1 * op2 op1 / op2 op1 % op2

The following java program, ArithmeticProg , defines two integers and two double-precision floating-point numbers and uses the five arithmetic operators to perform different arithmetic operations. This program also uses + to concatenate strings. The arithmetic operations are shown in boldface. Source Code 2.2

Information Sheet 1.2 Programming Control Structure

Java Relational Operators A relational operator compares two values and determines the relationship between them. For example, != returns true if its two operands are unequal. Relational operators are used to test whether two values are equal, whether one value is greater than another, and so forth. The relation operators in Java are: ==, !=, <, >, <=, and >=. The meanings of these operators are: Use Returns true if op1 is greater than op2 op1 is greater than or equal to op2 op1 is less than to op2 op1 is less than or equal to op2 op1 and op2 are equal op1 and op2 are not equal

op1 > op2 op1 >= op2 op1 < op2 op1 <= op2 op1 == op2 op1 != op2

Variables only exist within the structure in which they are defined. For example, if a variable is created within a method, it cannot be accessed outside the method. In addition, a different method can create a variable of the same name which will not conflict with the other variable. A java variable can be thought of The main use for the above relational operators is in conditional phrases

Example:

Java Logical Operators The logical operators are: OR(||) , AND(&&) , and NOT(!) . Java supplies a primitive data type called Boolean, instances of which can take the value true or false only, and have the default value false. The major use of Boolean facilities is to implement the expressions which control if decisions and while loops. These operators act on Boolean operands according to this table A T T F F B T F T F A && B T F F F A || B T T T F !A F F T T !B F T F T

! the NOT operator || the short-circuit OR operator && the short-circuit AND operator

Source Code 2.3

Self- Check 3.1-2


(Enumeration) : Enumerate the following: Java Arithmetic Operators: 1.___________________ 2.___________________ 3.___________________ 4.___________________ 5.___________________ Java Relational Operators 1.___________________ 2.___________________ 3.___________________ 4.___________________ 5.___________________ 6.___________________

ANSWER KEY 3.1-2


Java Arithmetic Operators: 1. Java Arithmetic Operators: 2. + (addition) 3. - (subtraction) 4. * (multiplication) 5. / (division) 6. % (modulo). Java Relational Operators 7. == 8. != 9. < 10. > 11. <= 12. >=

TASK SHEET 3.1-2


Title: Create a Program Using Basic Java Programming Elements

Performance Objective: Given the problem narrative assigned to you (refer to Project Sheet 3.2-1), you should be able to create/develop a program or application that will satisfy the requirements specified in your problem narrative, following the standard syntax and semantics of different Java Programming Elements Supplies/Materials Equipment : Problem Narrative 3.2-1 : Computer Package with a JAVA IDE installed

Steps/Procedure: Read and Analyze the requirements specified in the Problem Narrative Identify the required variables and their respective datatypes Turn-on your computer Open your JAVA IDE application program Write your source code Debug your source code for errors Compile your source code, if errors are found go back to step 6, otherwise, move to step 7 Run your source code Compare the OUTPUT of your program in the provided TEST CASES Present your work to your trainer

Assessment Method: Portfolio Performance Criteria Checklist

Project Sheet 3.1-2 Create a program that will assign numeric values to five (5) numeric variables then print the following results:

1. The sum of the first and last number 2. The difference of the second and third number 3. The product of the computed sum of the 1st and 5th number and the computed difference of the 2nd and 3rd number 4. The quotient of the resulting values in requirements number 3 and 1 5. Value of the last number
Test case #1 Your Your Your Your Your 1st number: 2nd number: 3rd number: 4th number: 5th number: no. no. no. no. no. 1: 2: 3: 4: 5: 5 4 3 2 1 6 1 6 1 1

Result Result Result Result Result

Test case #2 Your Your Your Your Your 1st number: 2nd number: 3rd number: 4th number: 5th number: no. no. no. no. no. 1: 2: 3: 4: 5: 10 7 3 8 3 13 4 52 4 3

Result Result Result Result Result

Test case #3 Your Your Your Your Your 1st number: 2nd number: 3rd number: 4th number: 5th number: no. no. no. no. no. 1: 2: 3: 4: 5: 15 -20 10 35 5 20 -30 -600 -30 5

Result Result Result Result Result

Performance Criteria Checklist 3.1-2


CRITERIA Did you. 1. Declare five (5) variables with numeric type such as: a. int b. byte c. long d. short e. float f. Double 2. Assign numeric values as defined in the test cases 3. Use proper operators to get the right results as defined in the problem 4. Use proper syntax and semantics in the program 5. Displayed the right results in the monitor as per test cases 6. Included internal documentation in the program using comments such as: a. in-line b. multi-line c. documentation
YES NO

Information Sheet 3.1-3


Control Statements in Java Programming Language

Learning Objectives: After reading this INFORMATION SHEET, YOU MUST be able to:

1.

Used appropriate language syntax for sequence, selection and iteration constructs based on the standard of specific programming language.

Introduction

The statements inside your source files (source code, / program) are generally executed from top to bottom, in the order that they appear. Control statements, however, break up the flow of execution by employing decision making, looping, and branching, enabling your program to conditionally execute particular blocks of code. This section describes the decision-making statements (if-then, if-then-else, switch), the looping statements (for, while, do-while), and the branching statements (break, continue, return) supported by the Java programming language.

Programming Control Structure Java Conditional Operators Java has the conditional operator. It's a ternary operator -- that is, it has three operands -and it comes in two pieces, ? and :, that have to be used together. It takes the form Boolean-expression ? expression-1 : expression-2 The JVM tests the value of Boolean-expression. If the value is true, it evaluates expression-1; otherwise, it evaluates expression-2. For Example if (a > b) { max = a; } else { max = b; }

Setting a single variable to one of two states based on a single condition is such a common use of if-else that a shortcut has been devised for it, the conditional operator, ?:. Using the conditional operator you can rewrite the above example in a single line like this: max = (a > b) ? a : b;

1. Java If-Else Statement The if-else class of statements should have the following form: if (condition_1) { statement(s)_if_condition_1_is_met; } else if (condition) { statement(s)_if_condition_2_is_met; } else { Statement(s)_if_none_of_the_first_conditions_ar e_met; }

All programming languages have some form of an if statement that allows you to test conditions. All arrays have lengths and we can access that length by referencing the variable arrayname.length. We test the length of the args array as follows: Source Code 1.1:

Compile and run this program and toss different inputs at it. You should note that there's no longer an ArrayIndexOutOfBoundsException if you don't give it any command line arguments at all. What we did was wrap the System.out.println(args[0]) statement in a conditional test, if (args.length > 0) { }. The code inside the braces, System.out.println(args[0]), now gets executed if and only if the length of the args array is greater than zero. In Java numerical greater than and lesser than tests are done with the > and < characters respectively. We can test for a number being less than or equal to and greater than or equal to with <= and >= respectively. Testing for equality is a little trickier. We would expect to test if two numbers were equal by using the = sign. However we've already used the = sign to set the value of a variable. Therefore we need a new symbol to test for equality. Java borrows C's double equals sign, ==, to test for equality. Lets look at an example when there are more then 1 statement in a branch and how braces are used indefinitely.

Source Code 1.2:

All conditional statements in Java require boolean values, and that's what the ==, <, >, <=, and >= operators all return. A boolean is a value that is either true or false. Unlike in C booleans are not the same as ints, and ints and booleans cannot be cast back and forth. If you need to set a boolean variable in a Java program, you have to use the constants true and false. false is not 0 and true is not non-zero as in C. Boolean values are no more integers than are strings. Else Lets look at some examples of if-else: Example 1 if(a == b) { c++; } if(a != b) { c--; } Example 2 if(a == b) { c++; } else { c--; }

We could add an else statement like so: Source Code 1.3:

Source Code 1.4:

Now that Hello at least doesn't crash with an ArrayIndexOutOfBoundsException we're still not done. java Hello works and Java Hello Rusty works, but if we type java Hello Elliotte Rusty Harold, Java still only prints Hello Elliotte. Let's fix that. We're not just limited to two cases though. We can combine an else and an if to make an else if and use this to test a whole range of mutually exclusive possibilities. Lets look at some examples of if-else-if:

Example 1 if(color == BLUE)) { System.out.println("The color is blue."); } else if(color == GREEN) { System.out.println("The color is green."); }

Example 2 if(employee.isManager()) { System.out.println("Is a Manager"); } else if(employee.isVicePresident()) { System.out.println("Is a Vice-President"); } else { System.out.println("Is a Worker"); }

Source Code 1.5

2. Java Loops (while, do-while and for loops) There may be a situation when we need to execute a block of code several number of times, and is often referred to as a loop. Java has very flexible three looping mechanisms. You can use one of the following three loops:

while Loop do...while Loop for Loop

The while Loop: A while loop is a control structure that allows you to repeat a task a certain number of times. Syntax: The syntax of a while loop is: while(Boolean_expression) { //Statements } When executing, if the boolean_expression result is true then the actions inside the loop will be executed. This will continue as long as the expression result is true. Here key point of the while loop is that the loop might not ever run. When the expression is tested and the result is false, the loop body will be skipped and the first statement after the while loop will be executed. Example: public class Test { public static void main(String args[]){ int x= 10; while( x < 20 ){ System.out.print("value of x : " + x ); x++; System.out.print("\n"); }

} }

This would produce following result: value value value value value value value value value of of of of of of of of of x x x x x x x x x : : : : : : : : : 10 11 12 13 14 15 16 17 18

value of x : 19

The do...while Loop: A do...while loop is similar to a while loop, except that a do...while loop is guaranteed to execute at least one time. Syntax: The syntax of a do...while loop is: Do { //Statements }while(Boolean_expression); Notice that the Boolean expression appears at the end of the loop, so the statements in the loop execute once before the Boolean is tested. If the Boolean expression is true, the flow of control jumps back up to do, and the statements in the loop execute again. This process repeats until the Boolean expression is false. Example: public class Test { public static void main(String args[]){ int x= 10; do{ System.out.print("value of x : " + x ); x++; System.out.print("\n"); }while( x < 20 );

} }

This would produce following result: value value value value value value value value value value of of of of of of of of of of x x x x x x x x x x : : : : : : : : : : 10 11 12 13 14 15 16 17 18 19

The for Loop: A for loop is a repetition control structure that allows you to efficiently write a loop that needs to execute a specific number of times.

A for loop is useful when you know how many times a task is to be repeated. Syntax: The syntax of a for loop is: for(initialization; Boolean_expression; update) { //Statements } Here is the flow of control in a for loop: 1. The initialization step is executed first, and only once. This step allows you to declare and initialize any loop control variables. You are not required to put a statement here, as long as a semicolon appears. 2. Next, the Boolean expression is evaluated. If it is true, the body of the loop is executed. If it is false, the body of the loop does not execute and flow of control jumps to the next statement past the for loop. 3. After the body of the for loop executes, the flow of control jumps back up to the update statement. This statement allows you to update any loop control variables. This statement can be left blank, as long as a semicolon appears after the Boolean expression. 4. The Boolean expression is now evaluated again. If it is true, the loop executes and the process repeats itself (body of loop, then update step,then Boolean expression). After the Boolean expression is false, the for loop terminates. Example: public class Test { public static void main(String args[]){ for(int x = 10; x < 20; x = x+1){ System.out.print("value of x : " + x ); System.out.print("\n"); }

} }

This would produce following result: value value value value value value value value value value of of of of of of of of of of x x x x x x x x x x : : : : : : : : : : 10 11 12 13 14 15 16 17 18 19

Self- Check 3.1-3


Simulation: Analyze the source code below and show the proper output.
public class Count{ public static void main(String[]args){ int count; for(count = 0;count<=10;count ++){ System.out.println(\n Number: , count); } } }

ANSWER KEY 3.1-3 Number: Number: Number: Number: Number: Number: Number: Number: Number: Number: Number: 0 1 2 3 4 5 6 7 8 9 10

TASK SHEET 3.1-3


Title: Create a Program Using Control Statements

Performance Objective: Given the problem narrative assigned to you (refer to Project Sheet 3.1-3), you should be able to create/develop a program or application that will satisfy the requirements specified in your problem narrative, following the standard syntax and semantics of different Java Programming Control Statements Supplies/Materials Equipment : Project Sheet 3.1.3 : Computer Package with a JAVA IDE installed

Steps/Procedure: Read and Analyze the requirements specified in the Problem Narrative Identify the required variables and their respective datatypes Turn-on your computer Open your JAVA IDE application program Write your source code Debug your source code for errors Compile your source code, if errors are found go back to step 6, otherwise, move to step 7 Run your source code Compare the OUTPUT of your program in the provided TEST CASES. If the test case results matches the OUTPUT of your program, move to step 10, otherwise, go back to step 5 Present your work to your trainer

Assessment Method: Portfolio Performance Criteria Checklist

Project Sheet 3.1-3 Create a program that will assign numeric values to four (4) numeric variables. Apply the following rules to get the required result. 1. If the 1st number is higher than the last number, print the computed sum of the 2nd and 3rd number 2. If the 2nd number is lower than the 3rd number, print the computed difference of the 1st and last number 3. If 1st number is equal to the 2nd number, print the computed product of the 3rd number and last number 4. If the 3rd and last number are equal, print the computed quotient of the 1st and 2nd number 5. If the sum of the 1st two numbers is higher than the sum of the last two numbers, print POO, otherwise, print MOO
Test case #1 Your Your Your Your 1st number: 2nd number: 3rd number: 4th number: 1 2 3 4

Difference between the 1st and last number is 1 MOO

Test case #2 Your Your Your Your 1st number: 2nd number: 3rd number: 4th number: 4 3 2 1

Sum of 2nd and 3rd number is 5 POO Test case #3 Your Your Your Your 1st number: 2nd number: 3rd number: 4th number: 5 5 2 2

Sum of 2nd and 3rd number is 7 Product of 3rd and last number is 4 Quotient of 1st and 2nd is 1 POO

Performance Criteria Checklist 3.1-3


CRITERIA Did you. 1. Declare at least four (4) numeric variables a. int b. byte c. long d. short e. float f. double 2. Assign numeric values as defined in the test cases 3. Use proper operators to get the right results as defined in the problem 4. The appropriate syntax for selection constructs is used 5. Displayed the right results in the monitor as per test cases 6. Included internal documentation in the program using comments such as: a. in-line b. multi-line c. documentation
YES NO

Information Sheet 3.1-4 Arrays in a Java


Learning Objectives: After reading this INFORMATION SHEET, YOU MUST be able to:

1. 2. 3. 4.

Define Java Array Explain the difference between an Array and a Variable Identify the advantages of using an Array Use Arrays to efficiently write a Java Program

Introduction In the previous lessons, you should now be able to create programs using different elements of Java programming language together with its different control statements. To be more efficient in writing codes, knowledge on arrays is important. This lesson will provide all necessary information to enable a programmer to effectively and efficiently integrate the use of arrays and arrays of object to satisfy a given problem requirement. What is an Array?

So far, you have been working with variables that hold only one value. The integer variables you have set up have held only one number, and the string variables just one long string of text. An array is a way to hold more than one value at a time. It's like a list of items. Think of an array as the columns in a spreadsheet. You can have a spreadsheet with only one column, or lots of columns. The data held in a single-list array might look like this:

Like a spreadsheet, arrays have a position number for each row. The positions (elements) in an array start at 0 and go up sequentially. Each position in the array can then hold a value. In the image above array position 0 is holding a value of 10, array position 1 is holding a value of 14, position 2 has a value of 36, and so on. To set up an array of number like that in the image above, you have to tell Java what kind of data is going in to your array (integers, strings, boolean values, etc). You then need to say how many positions the array has. You set them up like this: int[ ] aryNums; The only difference between setting up a normal integer variable and an array is a pair of square brackets after the data type. The square brackets are enough to tell Java that you want to set up an array. The name of the array above is aryNums. Just like normal variables, you can call them almost anything you like (with the same exceptions we mentioned earlier).

But this just tells Java that you want to set up an integer array. It doesn't say how many positions the array should hold. To do that, you have to set up a new array object: aryNums = new int[6]; You start with your array name, followed by the equals sign. After the equals sign, you need the Java keyword new, and then your data type again. After the data type come a pair of square brackets. In between the square brackets you need the size of the array. The size is how many positions the array should hold. If you prefer, you can put all that on one line: int[ ] aryNums = new int[6]; So we are telling Java to set up an array with 6 positions in it. After this line is executed, Java will assign default values for the array. Because we've set up an integer array, the default values for all 6 positions will be zero ( 0 ). To assign values to the various positions in an array, you do it in the normal way: aryNums[0] = 10; Here, a value of 10 is being assigned to position 0 in the array called aryNums. Again, the square brackets are used to refer to each position. If you want to assign a value of 14 to array position 1, the code would be this: aryNums[1] = 14; And to assign a value of 36 to array position 2, it's this: aryNums[2] = 36; Don't forget, because arrays start at 0, the third position in an array has the index number 2. If you know what values are going to be in the array, you can set them up like this instead: int[ ] aryNums = { 1, 2, 3, 4 }; This method of setting up an array uses curly brackets after the equals sign. In between the curly brackets, you type out the values that the array will hold. The first value will then be position 0, the second value position 1, and so on. Note that you still need the square brackets after int, but not the new keyword, or the repetition of the data type and square brackets. But this is just for data types of int values, string, and char values. Otherwise, you need the new keyword. So you can do this: String[ ] aryStrings = {"Autumn", "Spring", "Summer", "Winter" }; But not this: boolean[ ] aryBools = {false, true, false, true}; To set up a boolean array you still need the new keyword:

boolean[ ] aryBools = new boolean[ ] {false, true, false, true}; To get at the values held in your array, you type the name of the array followed by an array position in square brackets. Like this: System.out.println( aryNums[2] ); The above code will print out whatever value is held at array position 2 in the array called aryNums. But let's get some coding practice. Start a new project and call it anything you like. Don't forget to change the name of the Class to something relevant. Type the following code into your new Main method:

When you run the program you should see this in the Output window:
36

Change the array position number in the print line from 2 to 5 and 18 should print out instead Writing Efficient Code Using Arrays An array is a program element that allows a program to hold multiple values of the same time and is represented only by a single identifier. This characteristic enables the program to minimize the number of variables used in a program, especially if these variables are to hold values of the same type and same meaning.

The sample program below demonstrates the translation of code from a variable-centric approach to an array-based approach. Creation of five (5) numeric variables to hold five (5) numeric values A variable-centric approach int int int int int n1; n2; n3; n4; n5;

An Array-based approach int n[] = new int[5]; Comparing the two approaches, less code is needed when using arrays instead of variables

Self- Check 3.1-4


Identifications Instruction: Write your answer on the space provided in each number ________________ 1. Programming element that can hold multiple values simultaneously of the same type ________________ 2. These are the positions where values in an array is stored ________________ 3. Index number of the first element in an array ________________ 4. Symbol that is used to enclose the number that defines the number of elements an array will have ________________ 5. Keyword used to set the number of elements an array will have

Answer Key 3.1-4 1. 2. 3. 4. 5. Array Element 0 [] new

Evidence Plan

Competency standard: Unit of competency:

Programming NC IV Apply Object-Oriented Program Language Skills

Ways in which evidence will be collected: [tick the column]

Oral Questioning

Demonstration

Portfolio

The evidence must show that the trainee Designed and built application programs in accordance with the systems and programming requirements and standards* Developed applications or programs using an objectoriented language that meets required user specifications* Understands the concept of object-oriented programming Used a GUI to interact with the operator Used an Integrated Development Environment Testing and debugging techniques

Written

TABLE OF SPECIFICATION

Objectives/Content area/Topics

Knowledge

Comprehension

Application

# of items/ % of test 10 (40%)

Semantics and Syntax Elements of a Java Programming Language Control Statements in Java Arrays in Java TOTAL

2 (8%)

2 (8%)

6 (24%)

2 (8%)

4 (16%)

6 (24%)

2 (8%)

4 (16%)

6 (24%)

2 (8%) 8 (32%)

6 (24%)

1 (4%) 11 (44%)

3 (12%) 25 (100%)

Written Exam Multiple Choice Questions Instruction: Read the following questions and encircle the letter of your answer(s). 1. Study of the rules that govern the structure of sentences, and which determine their relative grammaticality (LC1K1) a. b. c. d. Syntax Semantics Grammar Keyword

2. A set of strict grammar rules, symbols, and special words used to construct a computer program. (LC1K2) a. b. c. d. Syntax Semantics Grammar Keyword

3. It is a name referenced to a value stored in the temporary memory of a computer (LC2K1) a. b. c. d. Operators Datatypes Expressions Variables

4. Java datatype that can be used to hold both whole and fractional numbers (LC2K2) a. b. c. d. int double boolean char

5. Control statement that is used to select a path of action based on the result of a given condition a. b. c. d. Selective Statements Looping Statements Iterative Statements For Loop Statement

6. Control statement that repeats an action or set of actions as long as the given condition remains true a. b. c. d. if else Statement if Statement Iterative Statements For Loop Statement

7. Index number of the first element in an array a. b. c. d. 8 0 4 None of the above

8. A program element that can be used to hold multiple values of the same type without the use of multiple variables a. b. c. d. Arrays Identifiers Comments Operators

9. Which of the following DOES NOT describe the data types used in JAVA (LC2C1) a. b. c. d. Java has eight (8) built-in, non-object data types Integers can hold both whole and fractional numeric values Data type represent what type of data a variable can hold Boolean type can ONLY hold two (2) distinct values, TRUE or FALSE

10. Which of the following choices can best describe these two (2) statements? (LC2C2) Statement A. A char data type is used for variables that will store single character values Statement B. A char data type value is always enclosed with an asterisk ( * ) a. b. c. d. Statement A is CORRECT while B is NOT Statement B is CORRECT while A is NOT Both statement are CORRECT None of the statements is CORRECT

11. Which of the following statements best describe the below program? Choose two (2) (LC1C1) public class JavaClass { public static void main(String[]args){ } } a. This program will NOT run because it lacks with a main method implementation b. This program will be compiled and run successfully but it will NOT produce any result c. This source code contains an empty main method, making it invalid d. This program will print the text Hello World in the computer screen e. This program has a file name of JavaClass.java 12. Which of the following statements best describe the below program? Choose two (2) (LC1C2) public class JavaClass { public static void main(String[]args){ } } a. This program will NOT run because it lacks with a main method implementation b. This program will be compiled and run successfully but it will NOT produce any result c. This source code contains an empty main method, making it invalid d. This program will print the text Hello World in the computer screen e. This program has a file name of JavaClass.java

13. Which of the following statements best describe the below program? Choose two (2) (LC2C3) int moo; moo = 4; moo++; System.out.println(This will NOT be printed!!!) ; a. b. c. d. The The The The program program program program will will will will NOT print ANYTHING print the given string constant decrement the value of variable moo by 1 increment the value of variable moo by 1

14. Which of the following statements best describe the below program? Choose two (2) (LC2C4) int number; number = input.nextInt(); System.out.println(You just entered + number) ; a. Accepts a floating-point value from the keyboard then prints it on the computer screen b. Accepts an Integer value from the keyboard then prints it on the computer screen c. Accepts an Integer value from the user then stores it in an integer variable d. Does NOT do anything

Simulation Instruction: Analyze each of the given source code and identify the FINAL value of the specified variable. Use a separate sheet to do your simulation 1. Consider the following program. What is the final value of variable foo? (LC3A1) int foo; foo = 15; if ( foo % 5 == 0) foo = foo * 2; else foo = foo + 2; 2. Consider the following program. What is the final value of variable goo? (LC3A2) int goo woo foo goo goo, woo, foo; = 30 ; = goo / 2 * 2 + 5 ; = goo + woo goo + 10 ; = foo ;

if ( woo > = foo ) goo = goo + 2 woo ; else if ( foo < woo ) goo = goo woo * 10 / 10 ; else goo = foo ; 3. Consider the following program. What is the final value of variable x? (LC3A3) int x; for (x=5;x<30;x++){ x=x+2; } 4. Consider the following program. What is the final value of variable coo? (LC3A4) int boo, coo, doo; boo = 5; doo = boo + 5; for(coo = 10; coo <= 20; coo++){ while (doo<15) doo = doo + 10; coo = doo; }

5. Consider the following program. What is the final value of variable wooh? (LC4A1) int[] pooh = {1,10,3,5,20,40,18,63,1,8}; int wooh = 5; for (int index=0; index<pooh.length; index++) { wooh += pooh[index]; pooh[index] = 0; }

Consider the following program. Place a check () mark on the space provided in each line that made this program syntactically erroneous. Choose three (6)
public class SomeOtherClass { public Static void main(string[] args){ System.out.println(THIS PROGRAM DISPLAYS A SERIES OF TEXT\n) System.out.println(This is a series of text\n\n\n) System.out.println(This is another series of text); System.out.println(END); } }

Performance Test

Specific Instruction for the Candidate Qualification Unit of Competency Programming NC IV Apply Object-Oriented Program Language Skills

PLEASE READ CAREFULLY Given the necessary materials and equipment, you are required to create/develop a program that will satisfy the requirement specified in the Problem Sheet in accordance with the accepted institutional/industry standards. (Allotted time: 5 hrs) 1. Gather instructions and relevant materials 2. Read and analyze the problem given in the Project Sheet 3. Identify the required input, process, and output 4. Turn-on computer and wait for the OS to completely load it self 5. Open the Java IDE 6. Create a Java Project File 7. Write source code 8. Modify source code as specified in the requirement 9. Debug source code errors 10. Compile source code, if errors are found, go back to step 9, otherwise, move to step 11 11. Run the program

12. Use test case to test the program. Once all the test cases are satisfied, move to step 12, otherwise, go back to step 8 13. Once finished, call the attention of your trainer to assess your work

Performance Criteria Checklist


CRITERIA 1. Declared/Created all the necessary variables and/or arrays 2. Use proper operators to get the right results as defined in the problem 3. The appropriate syntax for control statements constructs 4. Displayed the right results in the monitor as per test cases 5. Included internal documentation in the program using comments such as: a. in-line b. multi-line c. documentation
YES NO

QUESTIONING TOOL
Questions to probe the candidates underpinning knowledge Extension/Reflection Questions 1. Why do we need to include internal documentations in our program? (To make your source code easy for others to read and understand) 2. Discuss the Object-Oriented programming approach? (Identifying and Creating objects in a program to satisfy the user requirements and making it the center of it)
2.

Satisfactory response Yes No

What are the principles of Object-Oriented programming? (Encapsulation, Polymorphism, Abstraction, Inheritance)

4. Safety Questions 5. What will you do to avoid the corruption of program source code? (Continuous saving of files, Creating Backups, Use of Repository) 6. How will you minimize eye strain specially when working on computers within long period of time? Possible answers: Change your display from CRT to LCD/LED Blink more often Adjust your computer display settings (brightness, contrast, text size, color temperature) Proper lighting 7. 8. Contingency Questions 9. What will you do if the computer you are using is incapable of running a Java program? (Check if the computer has an installed Java Runtime Environment (JRE). If the computer has NO JRE, install and configure it) 10. 11. 12. Job Role/Environment Questions 13. How will you know that the program / application you created satisfy the user specified requirements? (Use of test cases) 14. 15. 16. Rules and Regulations

17. What are the best-practices in programming in creating a maintainable code? (Proper indentions, well commented codes, proper spacing, standard naming conventions are followed) 18. What is the standard naming convention for naming a Java class?(Java class name should begin with a capital letter. If the class name is made-up of multiple words, all words should begin with capital letters) 19. 20. The candidates knowledge was: underpinning Satisfactory

Not Satisfactory

Inventory of Training Resources For 10 trainees


Resources for presenting instruction Print Resources As per TR As per Inventory 10 10 10 For reproducti on Remarks Remarks

Books Computer Manuals CBLM

10 10 10

Non Print Resources

As per TR

As per Inventory 1

Installer CDs (JAVA IDEs)

For reproducti on

Resources for Skills practice of Competency #3 Apply Object-Oriented Program Language Skill Supplies and Materials As per TR 1 1 As per Inventory Remarks For reproduction

CBLM

Marker Reference Books Storage Medium (Flash Drive, External HDD) Tools

1 N/A 1 As per TR 10 10 101 As per TR 10 1

1 10 1 As per Inventory 10 10 10 As per Inventory 10 1 Remarks 1 Remarks

Java Language Windows OS MS Office Equipment

PC Packages OHP

LCD Projector White Board

1 1

1 1

Note: In the remarks section, remarks may include for repair, for replenishment, for reproduction, for maintenance etc.

WORKSHOP LAYOUT
FOR CAREER ENTRY COURSE FOR SOFTWARE DEVELOPMENT (JAVA)

You might also like