SlideShare a Scribd company logo
1 of 42
App Design for Business 
Topic: Coding Principles 
Topic Number: 2
Key topics / learning outcomes 
of this lecture 
• introducing bits & bytes; 
• introducing Java data types; 
• introducing Java decision making; 
• understanding variables; 
• learn to run Java code in IntelliJ; 
• introduction to xml; 
2
Computers work with bits and bytes 
comprising of 1’s and 0’s. 
B4004A L1 3
bits and bytes … 
B4004A L1 4
Example of bits in RGB colour model 
B4004A L1 5
RGB Colour Model - some colour 
values 
red green blue 
255 0 0 red 
0 255 0 green 
0 0 255 blue 
0 0 0 black 
100 100 100 dark gray 
255 255 255 white 
255 255 0 yellow 
255 0 255 magenta 
160 82 45 sienna 
B4004A L1 6
Bits and bytes are sometimes called 
machine code 
B4004A L1 7
End of introduction to bits and bytes 
B4004A L1 8
Introduction to Data Types 
Here you can see data types and how many bits 
are needed for each data type: 
B4004A L1 9
Data Types 
• byte - int 127 
• integer – int 2^31 
• short – int 32767 
• long – int 2^63-1 
• float – 1.754 
• double – 3.1415926 (to 754 decimal 
places) 
• boolean – True or False, 1 or 0 
• char – a (16 bit Unicode character) 
• String – String s = “This is a string” 
B4004A L1 10
End of Data Types 
B4004A L1 11
Introduction to Variables 
B4004A L1 12
How variables are used in programs … 
int a = 1; int b = 2; int c; 
c=(a+b); 
System.out.print(c); 
This will print out : 3 
B4004A L1 13
Assign different values to those 
variables … 
int a = 2; int b = 4; int c; 
c=(a+b); 
System.out.print(c); 
This will print out : 6 
B4004A L1 14
The same code in IntelliJ 
B4004A L1 15
Change of variable values … 
B4004A L1 16
Introducing loops to use with the variables … 
B4004A L1 17
Introducing loops – the for loop 
B4004A L1 18
Print a new line within the for loop 
B4004A L1 19
Increment variable a within the loop 
B4004A L1 20
Change variable values and multiply 
instead, achieve 75 times table … 
B4004A L1 21
How to print out in a coherent style 
(note error in terminal) … 
B4004A L1 22
Fix error, place the iterator below the 
System.out … 
B4004A L1 23
Loops – while loop 
B4004A L1 24
Loops - introducing the do…..while 
loop, compare the two … 
B4004A L1 25
End of loops 
B4004A L1 26
Strings 
String greeting = “Hello World!” 
int len = greeting.length(); 
char[] helloArray = { 'h', 'e', 'l', 'l', 'o', '.' }; 
String helloString = new String(helloArray); 
System.out.println(helloString); 
B4004A L1 27
Arraylist (slide 1 of 2) 
ArrayList al = new ArrayList(); 
System.out.println("Initial size of al: " + al.size()); 
// add elements to the array list 
al.add("C"); 
al.add("A"); 
al.add("E"); 
al.add("B"); 
al.add("D"); 
al.add("F"); 
al.add(1, "A2"); 
System.out.println("Size of al after additions: " + al.size()); 
B4004A L1 28
Arraylist (slide 2 of 2) 
// display the array list 
System.out.println("Contents of al: " + al); 
// Remove elements from the array list 
al.remove("F"); 
al.remove(2); 
System.out.println("Size of al after deletions: " + al.size()); 
System.out.println("Contents of al: " + al); 
} 
} 
This would produce the following result: 
Initial size of al: 0 
Size of al after additions: 7 
Contents of al: [C, A2, A, E, B, D, F] 
Size of al after deletions: 5 
Contents of al: [C, A2, E, B, D] 
B4004A L1 29
Arrays 
// initialize first element 
anArray[0] = 100; 
// initialize second element 
anArray[1] = 200; 
// and so forth 
anArray[2] = 300; 
anArray[3] = 400; 
anArray[4] = 500; 
anArray[5] = 600; 
B4004A L1 30
Arrays of different Data Types 
• byte[ ] anArrayOfBytes; 
• short[ ] anArrayOfShorts; 
• long[ ] anArrayOfLongs; 
• float[ ] anArrayOfFloats; 
• double[ ] anArrayOfDoubles; 
• boolean[ ] anArrayOfBooleans; 
• char[ ] anArrayOfChars; 
• String[ ] anArrayOfStrings; 
B4004A L1 31
Java Decision Structures 
if … 
if ….. else if …… else 
switch 
B4004A L1 32
If ….. else if ….. else 
public class Test { 
public static void main(String args[]){ 
int x = 30; 
if( x == 10 ){ 
System.out.print("Value of X is 10"); 
}else if( x == 20 ){ 
System.out.print("Value of X is 20"); 
}else if( x == 30 ){ 
System.out.print("Value of X is 30"); 
}else{ 
System.out.print("This is else statement"); 
} 
} 
} 
B4004A L1 33
Use if……… 
B4004A L1 34
Introducing break; within if 
B4004A L1 35
Introducing continue; within if 
B4004A L1 36
Introducing switch statement 
public class SwitchDemo { 
public static void main(String[] args) { 
int month = 8; 
String monthString; 
switch (month) { 
case 1: monthString = "January"; 
break; 
case 2: monthString = "February"; 
break; 
case 3: monthString = "March"; 
break; 
http://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html 
B4004A L1 37
… the end of the Introduction to Java and 
Coding Principles 
… next a brief look at xml 
B4004A L1 38
xml 
B4004A L1 39 
source www.w3schools.com/xml
xml is based on a particular xml 
Schema 
B4004A L1 40 
source www.w3schools.com/schema
Essential work for next week 
• Please consult the OLE for details of: 
– Essential readings* 
– Seminar/workshop preparation work* 
– Recommended further readings 
– Any additional learning 
* Essential readings and preparation work must always be completed in time 
for the next session 
41
End of presentation 
© Pearson College 2013

More Related Content

What's hot

What's hot (20)

Stack Data Structure V1.0
Stack Data Structure V1.0Stack Data Structure V1.0
Stack Data Structure V1.0
 
STACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURESTACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURE
 
10. Recursion
10. Recursion10. Recursion
10. Recursion
 
Pointer
PointerPointer
Pointer
 
Stack - Data Structure
Stack - Data StructureStack - Data Structure
Stack - Data Structure
 
Queue Implementation Using Array & Linked List
Queue Implementation Using Array & Linked ListQueue Implementation Using Array & Linked List
Queue Implementation Using Array & Linked List
 
computer notes - Data Structures - 8
computer notes - Data Structures - 8computer notes - Data Structures - 8
computer notes - Data Structures - 8
 
Stack queue
Stack queueStack queue
Stack queue
 
Loop Statements [5] M
Loop Statements [5] MLoop Statements [5] M
Loop Statements [5] M
 
Application of Stack - Yadraj Meena
Application of Stack - Yadraj MeenaApplication of Stack - Yadraj Meena
Application of Stack - Yadraj Meena
 
Lecture 2 coal sping12
Lecture 2 coal sping12Lecture 2 coal sping12
Lecture 2 coal sping12
 
Managing input and output operations in c
Managing input and output operations in cManaging input and output operations in c
Managing input and output operations in c
 
Stacks, Queues, Deques
Stacks, Queues, DequesStacks, Queues, Deques
Stacks, Queues, Deques
 
Stack and queue
Stack and queueStack and queue
Stack and queue
 
Stacks in c++
Stacks in c++Stacks in c++
Stacks in c++
 
Stacks and Queue - Data Structures
Stacks and Queue - Data StructuresStacks and Queue - Data Structures
Stacks and Queue - Data Structures
 
07. Arrays
07. Arrays07. Arrays
07. Arrays
 
Templates
TemplatesTemplates
Templates
 
Data structure lecture7
Data structure lecture7Data structure lecture7
Data structure lecture7
 
A1 11 functions
A1 11 functionsA1 11 functions
A1 11 functions
 

Viewers also liked

Pob stage 2 lecture 15 slides intro to contract
Pob stage 2 lecture 15 slides intro to contractPob stage 2 lecture 15 slides intro to contract
Pob stage 2 lecture 15 slides intro to contractmoduledesign
 
Management 2 seminar 2
Management 2 seminar 2Management 2 seminar 2
Management 2 seminar 2moduledesign
 
B417 ws six 6 students v0.2
B417 ws six  6 students v0.2B417 ws six  6 students v0.2
B417 ws six 6 students v0.2moduledesign
 
Seminar is4 dell post student
Seminar   is4 dell post studentSeminar   is4 dell post student
Seminar is4 dell post studentmoduledesign
 
Is1 workshop 9 make, take and sell challenge student
Is1 workshop 9   make, take and sell challenge studentIs1 workshop 9   make, take and sell challenge student
Is1 workshop 9 make, take and sell challenge studentmoduledesign
 
Seminar is1 coke pre student
Seminar   is1 coke pre studentSeminar   is1 coke pre student
Seminar is1 coke pre studentmoduledesign
 
Lecture 5 wireframes_and_ux_principles
Lecture 5 wireframes_and_ux_principlesLecture 5 wireframes_and_ux_principles
Lecture 5 wireframes_and_ux_principlesmoduledesign
 
Pob stage 2 marketing seminar 4 pre students
Pob stage 2 marketing   seminar 4 pre studentsPob stage 2 marketing   seminar 4 pre students
Pob stage 2 marketing seminar 4 pre studentsmoduledesign
 
Is1 workshop 5 make, take & sell challenge v2 student
Is1 workshop 5   make, take & sell challenge v2 studentIs1 workshop 5   make, take & sell challenge v2 student
Is1 workshop 5 make, take & sell challenge v2 studentmoduledesign
 
Is1 workshop 8 make, take & sell challenge student
Is1 workshop 8   make, take & sell challenge studentIs1 workshop 8   make, take & sell challenge student
Is1 workshop 8 make, take & sell challenge studentmoduledesign
 
Seminar is6 the triple bottom line post student
Seminar   is6 the triple bottom line post studentSeminar   is6 the triple bottom line post student
Seminar is6 the triple bottom line post studentmoduledesign
 
Management 2 lecture1v1
Management 2 lecture1v1Management 2 lecture1v1
Management 2 lecture1v1moduledesign
 
Lecture 1 dev_environment
Lecture 1 dev_environmentLecture 1 dev_environment
Lecture 1 dev_environmentmoduledesign
 
Lecture 1 industry studies student
Lecture 1   industry studies studentLecture 1   industry studies student
Lecture 1 industry studies studentmoduledesign
 
Lecture 2 industry studies student
Lecture 2   industry studies studentLecture 2   industry studies student
Lecture 2 industry studies studentmoduledesign
 
Lecture 9 mobilising knowledge
Lecture 9 mobilising knowledgeLecture 9 mobilising knowledge
Lecture 9 mobilising knowledgemoduledesign
 
Week7musculoskeletallecture
Week7musculoskeletallectureWeek7musculoskeletallecture
Week7musculoskeletallecturemoduledesign
 
Lecture 1 Analysis Intro
Lecture 1 Analysis IntroLecture 1 Analysis Intro
Lecture 1 Analysis Intromoduledesign
 
Lecture 5 organisational learning
Lecture 5 organisational learningLecture 5 organisational learning
Lecture 5 organisational learningmoduledesign
 

Viewers also liked (19)

Pob stage 2 lecture 15 slides intro to contract
Pob stage 2 lecture 15 slides intro to contractPob stage 2 lecture 15 slides intro to contract
Pob stage 2 lecture 15 slides intro to contract
 
Management 2 seminar 2
Management 2 seminar 2Management 2 seminar 2
Management 2 seminar 2
 
B417 ws six 6 students v0.2
B417 ws six  6 students v0.2B417 ws six  6 students v0.2
B417 ws six 6 students v0.2
 
Seminar is4 dell post student
Seminar   is4 dell post studentSeminar   is4 dell post student
Seminar is4 dell post student
 
Is1 workshop 9 make, take and sell challenge student
Is1 workshop 9   make, take and sell challenge studentIs1 workshop 9   make, take and sell challenge student
Is1 workshop 9 make, take and sell challenge student
 
Seminar is1 coke pre student
Seminar   is1 coke pre studentSeminar   is1 coke pre student
Seminar is1 coke pre student
 
Lecture 5 wireframes_and_ux_principles
Lecture 5 wireframes_and_ux_principlesLecture 5 wireframes_and_ux_principles
Lecture 5 wireframes_and_ux_principles
 
Pob stage 2 marketing seminar 4 pre students
Pob stage 2 marketing   seminar 4 pre studentsPob stage 2 marketing   seminar 4 pre students
Pob stage 2 marketing seminar 4 pre students
 
Is1 workshop 5 make, take & sell challenge v2 student
Is1 workshop 5   make, take & sell challenge v2 studentIs1 workshop 5   make, take & sell challenge v2 student
Is1 workshop 5 make, take & sell challenge v2 student
 
Is1 workshop 8 make, take & sell challenge student
Is1 workshop 8   make, take & sell challenge studentIs1 workshop 8   make, take & sell challenge student
Is1 workshop 8 make, take & sell challenge student
 
Seminar is6 the triple bottom line post student
Seminar   is6 the triple bottom line post studentSeminar   is6 the triple bottom line post student
Seminar is6 the triple bottom line post student
 
Management 2 lecture1v1
Management 2 lecture1v1Management 2 lecture1v1
Management 2 lecture1v1
 
Lecture 1 dev_environment
Lecture 1 dev_environmentLecture 1 dev_environment
Lecture 1 dev_environment
 
Lecture 1 industry studies student
Lecture 1   industry studies studentLecture 1   industry studies student
Lecture 1 industry studies student
 
Lecture 2 industry studies student
Lecture 2   industry studies studentLecture 2   industry studies student
Lecture 2 industry studies student
 
Lecture 9 mobilising knowledge
Lecture 9 mobilising knowledgeLecture 9 mobilising knowledge
Lecture 9 mobilising knowledge
 
Week7musculoskeletallecture
Week7musculoskeletallectureWeek7musculoskeletallecture
Week7musculoskeletallecture
 
Lecture 1 Analysis Intro
Lecture 1 Analysis IntroLecture 1 Analysis Intro
Lecture 1 Analysis Intro
 
Lecture 5 organisational learning
Lecture 5 organisational learningLecture 5 organisational learning
Lecture 5 organisational learning
 

Similar to Lecture 2 coding_principles

Seminar 2 coding_principles
Seminar 2 coding_principlesSeminar 2 coding_principles
Seminar 2 coding_principlesmoduledesign
 
Seminar 2 coding_principles
Seminar 2 coding_principlesSeminar 2 coding_principles
Seminar 2 coding_principlesmoduledesign
 
Reverse Engineering Dojo: Enhancing Assembly Reading Skills
Reverse Engineering Dojo: Enhancing Assembly Reading SkillsReverse Engineering Dojo: Enhancing Assembly Reading Skills
Reverse Engineering Dojo: Enhancing Assembly Reading SkillsAsuka Nakajima
 
Gsp 215 Future Our Mission/newtonhelp.com
Gsp 215 Future Our Mission/newtonhelp.comGsp 215 Future Our Mission/newtonhelp.com
Gsp 215 Future Our Mission/newtonhelp.comamaranthbeg8
 
GSP 215 Become Exceptional/newtonhelp.com
GSP 215 Become Exceptional/newtonhelp.comGSP 215 Become Exceptional/newtonhelp.com
GSP 215 Become Exceptional/newtonhelp.combellflower148
 
GSP 215 Perfect Education/newtonhelp.com
GSP 215 Perfect Education/newtonhelp.comGSP 215 Perfect Education/newtonhelp.com
GSP 215 Perfect Education/newtonhelp.combellflower169
 
GSP 215 Doing by learn/newtonhelp.com
GSP 215 Doing by learn/newtonhelp.comGSP 215 Doing by learn/newtonhelp.com
GSP 215 Doing by learn/newtonhelp.combellflower126
 
Computer Science Sample Paper 2015
Computer Science Sample Paper 2015Computer Science Sample Paper 2015
Computer Science Sample Paper 2015Poonam Chopra
 
Getting started cpp full
Getting started cpp   fullGetting started cpp   full
Getting started cpp fullVõ Hòa
 
computer science sample papers 2
computer science sample papers 2computer science sample papers 2
computer science sample papers 2Swarup Kumar Boro
 
Embedded systemsproject_2020
Embedded systemsproject_2020Embedded systemsproject_2020
Embedded systemsproject_2020Nikos Mouzakitis
 
CS Sample Paper 1
CS Sample Paper 1CS Sample Paper 1
CS Sample Paper 1kvs
 
Intro to tsql unit 10
Intro to tsql   unit 10Intro to tsql   unit 10
Intro to tsql unit 10Syed Asrarali
 
Computer science ms
Computer science msComputer science ms
Computer science msB Bhuvanesh
 
New Functional Features of Java 8
New Functional Features of Java 8New Functional Features of Java 8
New Functional Features of Java 8franciscoortin
 

Similar to Lecture 2 coding_principles (20)

Seminar 2 coding_principles
Seminar 2 coding_principlesSeminar 2 coding_principles
Seminar 2 coding_principles
 
Seminar 2 coding_principles
Seminar 2 coding_principlesSeminar 2 coding_principles
Seminar 2 coding_principles
 
Reverse Engineering Dojo: Enhancing Assembly Reading Skills
Reverse Engineering Dojo: Enhancing Assembly Reading SkillsReverse Engineering Dojo: Enhancing Assembly Reading Skills
Reverse Engineering Dojo: Enhancing Assembly Reading Skills
 
Gsp 215 Future Our Mission/newtonhelp.com
Gsp 215 Future Our Mission/newtonhelp.comGsp 215 Future Our Mission/newtonhelp.com
Gsp 215 Future Our Mission/newtonhelp.com
 
GSP 215 Become Exceptional/newtonhelp.com
GSP 215 Become Exceptional/newtonhelp.comGSP 215 Become Exceptional/newtonhelp.com
GSP 215 Become Exceptional/newtonhelp.com
 
GSP 215 Perfect Education/newtonhelp.com
GSP 215 Perfect Education/newtonhelp.comGSP 215 Perfect Education/newtonhelp.com
GSP 215 Perfect Education/newtonhelp.com
 
GSP 215 Doing by learn/newtonhelp.com
GSP 215 Doing by learn/newtonhelp.comGSP 215 Doing by learn/newtonhelp.com
GSP 215 Doing by learn/newtonhelp.com
 
Mcq cpup
Mcq cpupMcq cpup
Mcq cpup
 
Computer Science Sample Paper 2015
Computer Science Sample Paper 2015Computer Science Sample Paper 2015
Computer Science Sample Paper 2015
 
Getting started cpp full
Getting started cpp   fullGetting started cpp   full
Getting started cpp full
 
Cs practical file
Cs practical fileCs practical file
Cs practical file
 
computer science sample papers 2
computer science sample papers 2computer science sample papers 2
computer science sample papers 2
 
Embedded systemsproject_2020
Embedded systemsproject_2020Embedded systemsproject_2020
Embedded systemsproject_2020
 
CS Sample Paper 1
CS Sample Paper 1CS Sample Paper 1
CS Sample Paper 1
 
Intro to tsql unit 10
Intro to tsql   unit 10Intro to tsql   unit 10
Intro to tsql unit 10
 
Lecture 2 java.pdf
Lecture 2 java.pdfLecture 2 java.pdf
Lecture 2 java.pdf
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
Computer science ms
Computer science msComputer science ms
Computer science ms
 
New Functional Features of Java 8
New Functional Features of Java 8New Functional Features of Java 8
New Functional Features of Java 8
 
Ch9b
Ch9bCh9b
Ch9b
 

More from moduledesign

Bm512 b525 t1_s_v002
Bm512 b525 t1_s_v002Bm512 b525 t1_s_v002
Bm512 b525 t1_s_v002moduledesign
 
Bm512 b525 t5_l_v002
Bm512 b525 t5_l_v002Bm512 b525 t5_l_v002
Bm512 b525 t5_l_v002moduledesign
 
Bm509 b519 t1_l_v002
Bm509 b519 t1_l_v002Bm509 b519 t1_l_v002
Bm509 b519 t1_l_v002moduledesign
 
Corporate reporting and finance lecture 1
Corporate reporting and finance lecture 1Corporate reporting and finance lecture 1
Corporate reporting and finance lecture 1moduledesign
 
Af502 b523 t1_l1_v002
Af502 b523 t1_l1_v002Af502 b523 t1_l1_v002
Af502 b523 t1_l1_v002moduledesign
 
B515 lecture 1 edited_mr
B515 lecture 1 edited_mrB515 lecture 1 edited_mr
B515 lecture 1 edited_mrmoduledesign
 
B502 ethics lecture t005_rf
B502 ethics lecture t005_rfB502 ethics lecture t005_rf
B502 ethics lecture t005_rfmoduledesign
 
B526 ops pm lecture_t001b_with notes
B526 ops pm lecture_t001b_with notesB526 ops pm lecture_t001b_with notes
B526 ops pm lecture_t001b_with notesmoduledesign
 
B526 ops pm lecture_t009_rf
B526 ops pm lecture_t009_rfB526 ops pm lecture_t009_rf
B526 ops pm lecture_t009_rfmoduledesign
 
Pearson principles of business implementing strategy lecture 2
Pearson principles of business implementing strategy lecture 2Pearson principles of business implementing strategy lecture 2
Pearson principles of business implementing strategy lecture 2moduledesign
 
Generic lecture 4 research design (1)
Generic lecture 4 research design (1)Generic lecture 4 research design (1)
Generic lecture 4 research design (1)moduledesign
 
Generic lecture 3 literature review tutor
Generic lecture 3 literature review  tutorGeneric lecture 3 literature review  tutor
Generic lecture 3 literature review tutormoduledesign
 
Generic lecture 2 research proposal student
Generic lecture 2 research proposal studentGeneric lecture 2 research proposal student
Generic lecture 2 research proposal studentmoduledesign
 
Tutor version slides seminar 9 implementing knowledge management
Tutor version slides seminar 9 implementing knowledge managementTutor version slides seminar 9 implementing knowledge management
Tutor version slides seminar 9 implementing knowledge managementmoduledesign
 
Tutor version slides eminar 2 the nature of knowing
Tutor version slides eminar 2 the nature of knowingTutor version slides eminar 2 the nature of knowing
Tutor version slides eminar 2 the nature of knowingmoduledesign
 
Tutor version slides seminar 10 assignment support
Tutor version slides seminar 10 assignment supportTutor version slides seminar 10 assignment support
Tutor version slides seminar 10 assignment supportmoduledesign
 
Tutor version slides seminar 5 the learning organisation
Tutor version slides seminar 5 the learning organisationTutor version slides seminar 5 the learning organisation
Tutor version slides seminar 5 the learning organisationmoduledesign
 
Tutor version slides seminar 1 introduction to knowledge management
Tutor version slides seminar 1 introduction to knowledge managementTutor version slides seminar 1 introduction to knowledge management
Tutor version slides seminar 1 introduction to knowledge managementmoduledesign
 
Tutor version slides seminar 4 organisational learning
Tutor version slides seminar 4 organisational learningTutor version slides seminar 4 organisational learning
Tutor version slides seminar 4 organisational learningmoduledesign
 
Tutor version slides seminar 7 digital knowledge managment
Tutor version slides seminar 7 digital knowledge managment Tutor version slides seminar 7 digital knowledge managment
Tutor version slides seminar 7 digital knowledge managment moduledesign
 

More from moduledesign (20)

Bm512 b525 t1_s_v002
Bm512 b525 t1_s_v002Bm512 b525 t1_s_v002
Bm512 b525 t1_s_v002
 
Bm512 b525 t5_l_v002
Bm512 b525 t5_l_v002Bm512 b525 t5_l_v002
Bm512 b525 t5_l_v002
 
Bm509 b519 t1_l_v002
Bm509 b519 t1_l_v002Bm509 b519 t1_l_v002
Bm509 b519 t1_l_v002
 
Corporate reporting and finance lecture 1
Corporate reporting and finance lecture 1Corporate reporting and finance lecture 1
Corporate reporting and finance lecture 1
 
Af502 b523 t1_l1_v002
Af502 b523 t1_l1_v002Af502 b523 t1_l1_v002
Af502 b523 t1_l1_v002
 
B515 lecture 1 edited_mr
B515 lecture 1 edited_mrB515 lecture 1 edited_mr
B515 lecture 1 edited_mr
 
B502 ethics lecture t005_rf
B502 ethics lecture t005_rfB502 ethics lecture t005_rf
B502 ethics lecture t005_rf
 
B526 ops pm lecture_t001b_with notes
B526 ops pm lecture_t001b_with notesB526 ops pm lecture_t001b_with notes
B526 ops pm lecture_t001b_with notes
 
B526 ops pm lecture_t009_rf
B526 ops pm lecture_t009_rfB526 ops pm lecture_t009_rf
B526 ops pm lecture_t009_rf
 
Pearson principles of business implementing strategy lecture 2
Pearson principles of business implementing strategy lecture 2Pearson principles of business implementing strategy lecture 2
Pearson principles of business implementing strategy lecture 2
 
Generic lecture 4 research design (1)
Generic lecture 4 research design (1)Generic lecture 4 research design (1)
Generic lecture 4 research design (1)
 
Generic lecture 3 literature review tutor
Generic lecture 3 literature review  tutorGeneric lecture 3 literature review  tutor
Generic lecture 3 literature review tutor
 
Generic lecture 2 research proposal student
Generic lecture 2 research proposal studentGeneric lecture 2 research proposal student
Generic lecture 2 research proposal student
 
Tutor version slides seminar 9 implementing knowledge management
Tutor version slides seminar 9 implementing knowledge managementTutor version slides seminar 9 implementing knowledge management
Tutor version slides seminar 9 implementing knowledge management
 
Tutor version slides eminar 2 the nature of knowing
Tutor version slides eminar 2 the nature of knowingTutor version slides eminar 2 the nature of knowing
Tutor version slides eminar 2 the nature of knowing
 
Tutor version slides seminar 10 assignment support
Tutor version slides seminar 10 assignment supportTutor version slides seminar 10 assignment support
Tutor version slides seminar 10 assignment support
 
Tutor version slides seminar 5 the learning organisation
Tutor version slides seminar 5 the learning organisationTutor version slides seminar 5 the learning organisation
Tutor version slides seminar 5 the learning organisation
 
Tutor version slides seminar 1 introduction to knowledge management
Tutor version slides seminar 1 introduction to knowledge managementTutor version slides seminar 1 introduction to knowledge management
Tutor version slides seminar 1 introduction to knowledge management
 
Tutor version slides seminar 4 organisational learning
Tutor version slides seminar 4 organisational learningTutor version slides seminar 4 organisational learning
Tutor version slides seminar 4 organisational learning
 
Tutor version slides seminar 7 digital knowledge managment
Tutor version slides seminar 7 digital knowledge managment Tutor version slides seminar 7 digital knowledge managment
Tutor version slides seminar 7 digital knowledge managment
 

Recently uploaded

Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 

Recently uploaded (20)

Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 

Lecture 2 coding_principles

  • 1. App Design for Business Topic: Coding Principles Topic Number: 2
  • 2. Key topics / learning outcomes of this lecture • introducing bits & bytes; • introducing Java data types; • introducing Java decision making; • understanding variables; • learn to run Java code in IntelliJ; • introduction to xml; 2
  • 3. Computers work with bits and bytes comprising of 1’s and 0’s. B4004A L1 3
  • 4. bits and bytes … B4004A L1 4
  • 5. Example of bits in RGB colour model B4004A L1 5
  • 6. RGB Colour Model - some colour values red green blue 255 0 0 red 0 255 0 green 0 0 255 blue 0 0 0 black 100 100 100 dark gray 255 255 255 white 255 255 0 yellow 255 0 255 magenta 160 82 45 sienna B4004A L1 6
  • 7. Bits and bytes are sometimes called machine code B4004A L1 7
  • 8. End of introduction to bits and bytes B4004A L1 8
  • 9. Introduction to Data Types Here you can see data types and how many bits are needed for each data type: B4004A L1 9
  • 10. Data Types • byte - int 127 • integer – int 2^31 • short – int 32767 • long – int 2^63-1 • float – 1.754 • double – 3.1415926 (to 754 decimal places) • boolean – True or False, 1 or 0 • char – a (16 bit Unicode character) • String – String s = “This is a string” B4004A L1 10
  • 11. End of Data Types B4004A L1 11
  • 13. How variables are used in programs … int a = 1; int b = 2; int c; c=(a+b); System.out.print(c); This will print out : 3 B4004A L1 13
  • 14. Assign different values to those variables … int a = 2; int b = 4; int c; c=(a+b); System.out.print(c); This will print out : 6 B4004A L1 14
  • 15. The same code in IntelliJ B4004A L1 15
  • 16. Change of variable values … B4004A L1 16
  • 17. Introducing loops to use with the variables … B4004A L1 17
  • 18. Introducing loops – the for loop B4004A L1 18
  • 19. Print a new line within the for loop B4004A L1 19
  • 20. Increment variable a within the loop B4004A L1 20
  • 21. Change variable values and multiply instead, achieve 75 times table … B4004A L1 21
  • 22. How to print out in a coherent style (note error in terminal) … B4004A L1 22
  • 23. Fix error, place the iterator below the System.out … B4004A L1 23
  • 24. Loops – while loop B4004A L1 24
  • 25. Loops - introducing the do…..while loop, compare the two … B4004A L1 25
  • 26. End of loops B4004A L1 26
  • 27. Strings String greeting = “Hello World!” int len = greeting.length(); char[] helloArray = { 'h', 'e', 'l', 'l', 'o', '.' }; String helloString = new String(helloArray); System.out.println(helloString); B4004A L1 27
  • 28. Arraylist (slide 1 of 2) ArrayList al = new ArrayList(); System.out.println("Initial size of al: " + al.size()); // add elements to the array list al.add("C"); al.add("A"); al.add("E"); al.add("B"); al.add("D"); al.add("F"); al.add(1, "A2"); System.out.println("Size of al after additions: " + al.size()); B4004A L1 28
  • 29. Arraylist (slide 2 of 2) // display the array list System.out.println("Contents of al: " + al); // Remove elements from the array list al.remove("F"); al.remove(2); System.out.println("Size of al after deletions: " + al.size()); System.out.println("Contents of al: " + al); } } This would produce the following result: Initial size of al: 0 Size of al after additions: 7 Contents of al: [C, A2, A, E, B, D, F] Size of al after deletions: 5 Contents of al: [C, A2, E, B, D] B4004A L1 29
  • 30. Arrays // initialize first element anArray[0] = 100; // initialize second element anArray[1] = 200; // and so forth anArray[2] = 300; anArray[3] = 400; anArray[4] = 500; anArray[5] = 600; B4004A L1 30
  • 31. Arrays of different Data Types • byte[ ] anArrayOfBytes; • short[ ] anArrayOfShorts; • long[ ] anArrayOfLongs; • float[ ] anArrayOfFloats; • double[ ] anArrayOfDoubles; • boolean[ ] anArrayOfBooleans; • char[ ] anArrayOfChars; • String[ ] anArrayOfStrings; B4004A L1 31
  • 32. Java Decision Structures if … if ….. else if …… else switch B4004A L1 32
  • 33. If ….. else if ….. else public class Test { public static void main(String args[]){ int x = 30; if( x == 10 ){ System.out.print("Value of X is 10"); }else if( x == 20 ){ System.out.print("Value of X is 20"); }else if( x == 30 ){ System.out.print("Value of X is 30"); }else{ System.out.print("This is else statement"); } } } B4004A L1 33
  • 35. Introducing break; within if B4004A L1 35
  • 36. Introducing continue; within if B4004A L1 36
  • 37. Introducing switch statement public class SwitchDemo { public static void main(String[] args) { int month = 8; String monthString; switch (month) { case 1: monthString = "January"; break; case 2: monthString = "February"; break; case 3: monthString = "March"; break; http://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html B4004A L1 37
  • 38. … the end of the Introduction to Java and Coding Principles … next a brief look at xml B4004A L1 38
  • 39. xml B4004A L1 39 source www.w3schools.com/xml
  • 40. xml is based on a particular xml Schema B4004A L1 40 source www.w3schools.com/schema
  • 41. Essential work for next week • Please consult the OLE for details of: – Essential readings* – Seminar/workshop preparation work* – Recommended further readings – Any additional learning * Essential readings and preparation work must always be completed in time for the next session 41
  • 42. End of presentation © Pearson College 2013