0% found this document useful (0 votes)
169 views58 pages

Java CS Grade 11

This document provides an overview and examples of topics related to computational thinking and Java programming. It includes: - An introduction to the unit which covers Java programming skills, computational thinking, algorithm design and analysis, and programming concepts over 4 months. - Sections on introduction to Java programming with examples like variables, data types, selection, repetition, functions and arrays. - Examples of Java programs to demonstrate if/else statements for checking odd/even numbers and leap years. - Code snippets and explanations of switch statements in Java with examples checking vowels vs consonants.

Uploaded by

swati goel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
169 views58 pages

Java CS Grade 11

This document provides an overview and examples of topics related to computational thinking and Java programming. It includes: - An introduction to the unit which covers Java programming skills, computational thinking, algorithm design and analysis, and programming concepts over 4 months. - Sections on introduction to Java programming with examples like variables, data types, selection, repetition, functions and arrays. - Examples of Java programs to demonstrate if/else statements for checking odd/even numbers and leap years. - Code snippets and explanations of switch statements in Java with examples checking vowels vs consonants.

Uploaded by

swati goel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 58

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

You might also like