Topic 4 Computational Thinking
This is a large unit that will take more then 4 months:
The unit is broken into components as follows:
• Introduction to Java programming skills
• Computational thinking
• Program design using pseudo code, flow charts and trace tables
• Searching & sorting algorithms
• Algorithm efficiency & Big O
• Programming concepts
Introduction to Java programming skills
• An introduction to programming with Java. Includes:
• Hello world
• Variables & data types
• Numbers & the Math library
• Strings & casting
• Selection
• Repetition
• Functions
• Arrays
• Exceptions
• Files
What is java? Why Use Java?
Java Compiler
• Bluej Software: https://bluej.org/
• Online Editor:
https://www.onlinegdb.com/online_java_com
piler
Topic: Java Variable ,Data types, Java Conditions
and If statement
Class Practice Session
//A Java Program to demonstrate the use of if-else statement.
//It is a program of odd and even number.
public class IfElseExample {
public static void main(String[] args) {
//defining a variable
int number=13;
//Check if the number is divisible by 2 or not
if(number%2==0){
System.out.println("even number");
}else{
System.out.println("odd number");
}
}
}
Class Practice Session
//A Java Program to demonstrate the use of if-else statement.
//A year is leap, if it is divisible by 4 and 400. But, not by 100.
A year is leap, if it is divisible by 4 and 400. But, not by 100.
public class LeapYearExample {
public static void main(String[] args) {
int year=2020;
if(((year % 4 ==0) && (year % 100 !=0)) || (year % 400==0)){
System.out.println("LEAP YEAR");
}
else{
System.out.println("COMMON YEAR");
}
}
}
Activity-Breakout Room
Date :5th August 2020
Recap java condition and if statement
What is the output of each of the following
code fragments?
Write the condition Statement of the
following
Self evaluation
Java IO : Input-output in Java
Java Program to get input from user
Class practice Session
Example to find greatest number
Output
Class practice Session
Example to take user input
Output
Learning Resource
• https://www.programiz.com/java-programmin
g/scanner
Java MCQ
Java Switch Statements
Break Keyword
Example with or without break statement
Class practice Session
Java Program to check Vowel or Consonant
using Switch Case :
The alphabets A, E, I, O and U (smallcase and
uppercase) are known as Vowels and rest of
the alphabets are known as consonants. Here
we will write a java program that checks
whether the input character is vowel or
Consonant using Switch Case in Java.
Output
Fundamental Operations
Fundamental vs Complex