SlideShare a Scribd company logo
Seminar: Coding Principles
Topic Number: 2
App Design for Business
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
PPT
PPT
Loop Statements [5] M
Seminar 2 coding_principles
Operators
Functions & Procedures [7]
C programming Lab 1
Programming fundamentals
C programming Lab 2
Loop Statements [5] M

What's hot (20)

PDF
escape sequences and substitution markers
PPTX
Managing input and output operations in c
PPTX
Input Output Management In C Programming
DOCX
Relational Operators in C
PDF
csharp repitition structures
PDF
CP Handout#6
PPS
02 iec t1_s1_oo_ps_session_02
DOCX
Bti1022 lab sheet 9 10
PDF
CP Handout#7
PDF
PPTX
Input output statement in C
PDF
CP Handout#8
PDF
selection structures
PDF
CP Handout#2
PDF
7. input and output functions
DOCX
Dam31303 dti2143 lab sheet 7
DOCX
Qust & ans inc
PPTX
Basic Input and Output
PDF
A simple program C# program
PPT
Flow Chart & Input Output Statement [3] M
escape sequences and substitution markers
Managing input and output operations in c
Input Output Management In C Programming
Relational Operators in C
csharp repitition structures
CP Handout#6
02 iec t1_s1_oo_ps_session_02
Bti1022 lab sheet 9 10
CP Handout#7
Input output statement in C
CP Handout#8
selection structures
CP Handout#2
7. input and output functions
Dam31303 dti2143 lab sheet 7
Qust & ans inc
Basic Input and Output
A simple program C# program
Flow Chart & Input Output Statement [3] M
Ad

Similar to Seminar 2 coding_principles (20)

PPTX
Programming Fundamentals in Python - Sequence Structure
PPTX
1. Python Programming Basic1bbbbbbbbbbbbbbbb.pptx
PPTX
C#.net
DOCX
Muzzammilrashid
PPTX
Python programming workshop session 2
PPTX
C decision making and looping.
DOC
Datastructure notes
DOCX
UNIT-II CP DOC.docx
DOCX
Spring 2014 CSCI 111 Final exam of 1 61. (2 points) Fl.docx
PDF
Programming Fundamentals Functions in C and types
PPTX
Lecture 2 coding_principles
PPT
Practical basics on c++
PDF
Mid term sem 2 1415 sol
PPTX
Ch2 Elementry Programmin as per gtu oop.pptx
PDF
Introduction to Computer and Programing - Lecture 04
PDF
Compiler Construction for DLX Processor
PPT
keyword
PPT
keyword
PPT
Fundamental of C Programming Language and Basic Input/Output Function
PPTX
Lecture 2 coding_principles
Programming Fundamentals in Python - Sequence Structure
1. Python Programming Basic1bbbbbbbbbbbbbbbb.pptx
C#.net
Muzzammilrashid
Python programming workshop session 2
C decision making and looping.
Datastructure notes
UNIT-II CP DOC.docx
Spring 2014 CSCI 111 Final exam of 1 61. (2 points) Fl.docx
Programming Fundamentals Functions in C and types
Lecture 2 coding_principles
Practical basics on c++
Mid term sem 2 1415 sol
Ch2 Elementry Programmin as per gtu oop.pptx
Introduction to Computer and Programing - Lecture 04
Compiler Construction for DLX Processor
keyword
keyword
Fundamental of C Programming Language and Basic Input/Output Function
Lecture 2 coding_principles
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
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
Lesson notes of climatology university.
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Complications of Minimal Access Surgery at WLH
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Pre independence Education in Inndia.pdf
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Sports Quiz easy sports quiz sports quiz
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
Basic Mud Logging Guide for educational purpose
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Supply Chain Operations Speaking Notes -ICLT Program
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
TR - Agricultural Crops Production NC III.pdf
O7-L3 Supply Chain Operations - ICLT Program
Lesson notes of climatology university.
2.FourierTransform-ShortQuestionswithAnswers.pdf
Complications of Minimal Access Surgery at WLH
Renaissance Architecture: A Journey from Faith to Humanism
Pre independence Education in Inndia.pdf
human mycosis Human fungal infections are called human mycosis..pptx
Final Presentation General Medicine 03-08-2024.pptx
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Microbial disease of the cardiovascular and lymphatic systems
102 student loan defaulters named and shamed – Is someone you know on the list?
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Sports Quiz easy sports quiz sports quiz
Microbial diseases, their pathogenesis and prophylaxis
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Basic Mud Logging Guide for educational purpose

Seminar 2 coding_principles

  • 1. Seminar: Coding Principles Topic Number: 2 App Design for Business
  • 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
  • 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.