SlideShare a Scribd company logo
Application Engineering and Development 
Seminar: Coding Principles 
Topic Number: 2
Key topics and learning outcomes of this Seminar 
• Reinforce the Java code introduced during Lecture 2 by 
running Java code in IntelliJ; 
• Develop confidence working with Intellij and logic/layout 
files; 
• Develop Mobile Application Programming skills;
Open IntelliJ, Create New Project 
3
Select ‘Java’ 
B4004A L1 4
Select as Screenshot 
B4004A L1 5
Add a Project name 
B4004A L1 6
Opens Class File: Main.java 
B4004A L1 7
Run the program, and check the terminal returns ‘Hello 
World!’ 
B4004A L1 8 
This is the ‘run’ button:
Type some code into Main.java and run it: 
Type this code into the same file in IntelliJ and run it. Some code will need to be deleted to reflect 
correctly the code below (ie the Hello World code section). Check the Terminal output. 
public class Main { 
public static void main(String[] args) { 
int a = 2;int b = 4; int c; 
c=a+b; 
System.out.print(c); 
} 
} 
Change the variables a and b to different values and then run the code again and check the 
correct result shows in the Terminal. 
B4004A L1 9
Create a for loop 
Create a for loop: 
public class Main { 
public static void main(String[] args) { 
for(int i=0;i<10;i++) { 
int a = 2; int b = 4; int c; 
c = a + b; 
System.out.print(c); 
} 
} 
} 
… then make it print out each number on a new line by adding “n” for a new line: 
System.out.print(c + "n"); 
… change i<10 to i<20 and run the program again to see what happens 
B4004A L1 10
Change code to make it add 1 to each number. 
… then make the program add 1 to each number and print it out in the Terminal by adding: 
a = a+1; 
You will need to move the declaration (int a = 2; int b = 4; int c;) out of the for loop, otherwise the result will remain static as the 
program will always go back to those values. Try running it without moving the declaration first, check the output in the Terminal. 
Then move it. Put it the line above the for loop. Run it again and check the output in the Terminal. 
public class Main { 
public static void main(String[] args) { 
int a = 2; int b = 4; int c; 
for(int i=0;i<13;i++) { 
c = a + b; 
a = a + 1; 
System.out.print(c + "n"); 
} 
} 
} 
B4004A L1 11
Using multiplication * 
Change the code a little to make it run the 75 times table. 
public class Main { 
public static void main(String[] args) { 
int a = 0; int b = 75; int c; 
for(int i=0;i<13;i++) { 
c = a * b; 
a = a + 1; 
System.out.print(c + "n"); 
} 
} 
} 
B4004A L1 12
Concatenating Output 
Change the output line of code to this and then look at the output: 
System.out.print(a + " times " + b + " = " + c + "n"); 
Try and write some code to print a box using the character ‘X’ that prints out the same 
number of ‘Xs’ across and down. 
B4004A L1 13
Working with the if statement; 
Try writing this code, changing the value of x to get it to run each statement, and then remove some lines of 
code so that there are less decisions. Pay attention to the brackets. Finally end up with just an if statement, 
without 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 14
Summary 
This seminar has reinforced the coding principles learned during the 
corresponding lecture; 
This seminar has provided users of IntelliJ with a good understanding 
of how to manage Java code within IntelliJ Development Environment;
Next session 
Workshop 2 – Coding Principles 
This workshop covers Operators and Strings
End of Seminar 
Note: This recording is for your 
personal use only and not for further 
distribution or wider review. 
© Pearson College 2013
Seminar 2 coding_principles

More Related Content

PPTX
Seminar 2 coding_principles
PPTX
Operators
PPT
Functions & Procedures [7]
DOCX
C programming Lab 1
DOCX
Programming fundamentals
DOCX
C programming Lab 2
PPTX
Managing input and output operations in c
DOCX
Relational Operators in C
Seminar 2 coding_principles
Operators
Functions & Procedures [7]
C programming Lab 1
Programming fundamentals
C programming Lab 2
Managing input and output operations in c
Relational Operators in C

What's hot (20)

PPTX
Input Output Management In C Programming
PPT
Loop Statements [5] M
PDF
escape sequences and substitution markers
PPT
PDF
csharp repitition structures
PDF
CP Handout#6
PDF
CP Handout#7
PDF
7. input and output functions
PPTX
Input output statement in C
PDF
CP Handout#8
PPS
02 iec t1_s1_oo_ps_session_02
PDF
C Building Blocks
PDF
CP Handout#2
PPTX
Increment and Decrement operators in C++
PDF
PPTX
Data Input and Output
PPTX
Simple c program
PDF
selection structures
DOCX
Exp 3-2 d 422
PPS
C programming session 03
Input Output Management In C Programming
Loop Statements [5] M
escape sequences and substitution markers
csharp repitition structures
CP Handout#6
CP Handout#7
7. input and output functions
Input output statement in C
CP Handout#8
02 iec t1_s1_oo_ps_session_02
C Building Blocks
CP Handout#2
Increment and Decrement operators in C++
Data Input and Output
Simple c program
selection structures
Exp 3-2 d 422
C programming session 03
Ad

Similar to Seminar 2 coding_principles (20)

PPTX
C#.net
PPTX
Lecture 2 coding_principles
PPTX
1. Python Programming Basic1bbbbbbbbbbbbbbbb.pptx
DOCX
Muzzammilrashid
DOCX
Qust & ans inc
PPTX
Python programming workshop session 2
PPTX
Lecture 2 coding_principles
PPTX
Programming Fundamentals in Python - Sequence Structure
DOC
Datastructure notes
DOCX
UNIT-II CP DOC.docx
DOCX
Spring 2014 CSCI 111 Final exam of 1 61. (2 points) Fl.docx
PPTX
C decision making and looping.
PDF
C# 6Write a program that creates a Calculation ClassUse the foll.pdf
PDF
Programming Fundamentals Functions in C and types
PDF
Introduction to Computer and Programing - Lecture 04
DOC
5: Every Java application is required to have
DOC
15: Which method call converts the value in variable stringVariable to an int...
DOC
Comp 328 final guide (devry)
DOC
7: Assume the following class declaration.
DOC
18: Which of the following does not generate an event?
C#.net
Lecture 2 coding_principles
1. Python Programming Basic1bbbbbbbbbbbbbbbb.pptx
Muzzammilrashid
Qust & ans inc
Python programming workshop session 2
Lecture 2 coding_principles
Programming Fundamentals in Python - Sequence Structure
Datastructure notes
UNIT-II CP DOC.docx
Spring 2014 CSCI 111 Final exam of 1 61. (2 points) Fl.docx
C decision making and looping.
C# 6Write a program that creates a Calculation ClassUse the foll.pdf
Programming Fundamentals Functions in C and types
Introduction to Computer and Programing - Lecture 04
5: Every Java application is required to have
15: Which method call converts the value in variable stringVariable to an int...
Comp 328 final guide (devry)
7: Assume the following class declaration.
18: Which of the following does not generate an event?
Ad

More from moduledesign (20)

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

Recently uploaded (20)

PDF
TR - Agricultural Crops Production NC III.pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Basic Mud Logging Guide for educational purpose
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
Cell Structure & Organelles in detailed.
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
Cell Types and Its function , kingdom of life
PDF
Pre independence Education in Inndia.pdf
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
TR - Agricultural Crops Production NC III.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Basic Mud Logging Guide for educational purpose
O7-L3 Supply Chain Operations - ICLT Program
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Cell Structure & Organelles in detailed.
Microbial diseases, their pathogenesis and prophylaxis
Supply Chain Operations Speaking Notes -ICLT Program
STATICS OF THE RIGID BODIES Hibbelers.pdf
GDM (1) (1).pptx small presentation for students
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Abdominal Access Techniques with Prof. Dr. R K Mishra
2.FourierTransform-ShortQuestionswithAnswers.pdf
FourierSeries-QuestionsWithAnswers(Part-A).pdf
VCE English Exam - Section C Student Revision Booklet
Cell Types and Its function , kingdom of life
Pre independence Education in Inndia.pdf
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx

Seminar 2 coding_principles

  • 1. Application Engineering and Development Seminar: Coding Principles Topic Number: 2
  • 2. Key topics and learning outcomes of this Seminar • Reinforce the Java code introduced during Lecture 2 by running Java code in IntelliJ; • Develop confidence working with Intellij and logic/layout files; • Develop Mobile Application Programming skills;
  • 3. Open IntelliJ, Create New Project 3
  • 5. Select as Screenshot B4004A L1 5
  • 6. Add a Project name B4004A L1 6
  • 7. Opens Class File: Main.java B4004A L1 7
  • 8. Run the program, and check the terminal returns ‘Hello World!’ B4004A L1 8 This is the ‘run’ button:
  • 9. Type some code into Main.java and run it: Type this code into the same file in IntelliJ and run it. Some code will need to be deleted to reflect correctly the code below (ie the Hello World code section). Check the Terminal output. public class Main { public static void main(String[] args) { int a = 2;int b = 4; int c; c=a+b; System.out.print(c); } } Change the variables a and b to different values and then run the code again and check the correct result shows in the Terminal. B4004A L1 9
  • 10. Create a for loop Create a for loop: public class Main { public static void main(String[] args) { for(int i=0;i<10;i++) { int a = 2; int b = 4; int c; c = a + b; System.out.print(c); } } } … then make it print out each number on a new line by adding “n” for a new line: System.out.print(c + "n"); … change i<10 to i<20 and run the program again to see what happens B4004A L1 10
  • 11. Change code to make it add 1 to each number. … then make the program add 1 to each number and print it out in the Terminal by adding: a = a+1; You will need to move the declaration (int a = 2; int b = 4; int c;) out of the for loop, otherwise the result will remain static as the program will always go back to those values. Try running it without moving the declaration first, check the output in the Terminal. Then move it. Put it the line above the for loop. Run it again and check the output in the Terminal. public class Main { public static void main(String[] args) { int a = 2; int b = 4; int c; for(int i=0;i<13;i++) { c = a + b; a = a + 1; System.out.print(c + "n"); } } } B4004A L1 11
  • 12. Using multiplication * Change the code a little to make it run the 75 times table. public class Main { public static void main(String[] args) { int a = 0; int b = 75; int c; for(int i=0;i<13;i++) { c = a * b; a = a + 1; System.out.print(c + "n"); } } } B4004A L1 12
  • 13. Concatenating Output Change the output line of code to this and then look at the output: System.out.print(a + " times " + b + " = " + c + "n"); Try and write some code to print a box using the character ‘X’ that prints out the same number of ‘Xs’ across and down. B4004A L1 13
  • 14. Working with the if statement; Try writing this code, changing the value of x to get it to run each statement, and then remove some lines of code so that there are less decisions. Pay attention to the brackets. Finally end up with just an if statement, without 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 14
  • 15. Summary This seminar has reinforced the coding principles learned during the corresponding lecture; This seminar has provided users of IntelliJ with a good understanding of how to manage Java code within IntelliJ Development Environment;
  • 16. Next session Workshop 2 – Coding Principles This workshop covers Operators and Strings
  • 17. End of Seminar Note: This recording is for your personal use only and not for further distribution or wider review. © Pearson College 2013

Editor's Notes

  • #2: Tutor notes to go in here
  • #17: Provide guidance to students on the preparation for next week’s activity.