0% found this document useful (0 votes)
2 views32 pages

If, Else Array

The document provides an overview of several high-level programming languages including Java, C, C++, Python, and JavaScript, detailing their characteristics, uses, and basic syntax. It also covers control structures such as if-else statements, loops, and arrays, providing examples in Java and C/C++. Key points about each language and programming concepts are summarized for quick reference.

Uploaded by

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

If, Else Array

The document provides an overview of several high-level programming languages including Java, C, C++, Python, and JavaScript, detailing their characteristics, uses, and basic syntax. It also covers control structures such as if-else statements, loops, and arrays, providing examples in Java and C/C++. Key points about each language and programming concepts are summarized for quick reference.

Uploaded by

Amanuel Girma
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Java, C, C++, Python and JavaScript Programming Language (High Level)

Java
Java is an object-oriented, platform-independent programming language widely used for
enterprise systems, banking applications, Android apps, and large-scale back-end systems. It is
known for its stability, security, and strong memory management through the Java Virtual
Machine (JVM).
C
C is a low-level, procedural programming language used for system programming such as
operating systems, embedded systems, and hardware-related applications. It is fast, efficient, and
gives direct control over memory, making it ideal for performance-critical tasks.
C++
C++ is an extension of C that supports object-oriented programming in addition to procedural
programming. It is commonly used in game development, real-time systems, high-performance
applications, and software requiring both speed and complex data structures.
Python
Python is a high-level, interpreted language known for its simplicity and readability. It is widely
used in data science, artificial intelligence, machine learning, automation, web development, and
scripting due to its rich libraries and rapid development capability.
JavaScript
JavaScript is a scripting language primarily used for web development to create interactive and
dynamic web pages. It runs in web browsers and on servers ([Link]), making it essential for
front-end and full-stack development.
1️. if Statement
Used to execute code only when a condition is true.
Example:
int age = 20;
if (age >= 18) {
[Link]("You are an adult.");
}
📌 If the condition is false, nothing happens.
2️. if – else Statement
Used when there are two possible outcomes.
Example:
int marks = 45;
if (marks >= 50) {
[Link]("Pass");
} else {
[Link]("Fail");
}

1
Java, C, C++, Python and JavaScript Programming Language (High Level)
3. if – else if – else Statement
Used when there are more than two conditions.
Example:
int score = 85;
if (score >= 90) {
[Link]("Grade A");
} else if (score >= 75) {
[Link]("Grade B");
} else if (score >= 50) {
[Link]("Grade C");
} else {
[Link]("Fail");
}
4️. While Loop
Used to repeat code while a condition is true.
Example:
int i = 1;
while (i <= 5) {
[Link](i);
i++;
}
📌 Output:
1
2
3
4
5
5️. Check Even or Odd Number
An even number is divisible by 2 (remainder = 0).
Example:
int number = 7;
if (number % 2 == 0) {
[Link]("Even number");
} else {
[Link]("Odd number");
}
6. Even Numbers Using while Loop
Print even numbers from 1 to 10.
int num = 2;
while (num <= 10) {

2
Java, C, C++, Python and JavaScript Programming Language (High Level)
[Link](num);
num += 2;
}
7️. Combined Example (if + while + even/odd)
int n = 1;
while (n <= 10) {
if (n % 2 == 0) {
[Link](n + " is Even");
} else {
[Link](n + " is Odd");
}
n++;
}
8️. Key Points to Remember
Statement Purpose
Check one condition
else if Check multiple conditions
else Default action
while Repeat while condition is true
% Modulus operator (remainder)

1️. What is an Array in Java?


An array is a data structure used to store multiple values of the same data type in one variable.
📌 Instead of creating many variables:
int m1, m2, m3, m4, m5;
✅ Use an array:
int[] marks = {70, 65, 80, 90, 75};
2️. Declaring an Array
Syntax:
dataType[] arrayName;
Example:
int[] numbers;
String[] names;
3. Creating an Array
Example:
int[] numbers = new int[5];
📌 Creates an array that can store 5 integers.
4️. Initializing an Array
Method 1: Direct Initialization
int[] numbers = {10, 20, 30, 40, 50};
3
Java, C, C++, Python and JavaScript Programming Language (High Level)
Method 2: Assign Values One by One
int[] numbers = new int[3];
numbers[0] = 5;
numbers[1] = 10;
numbers[2] = 15;
📌 Array index starts from 0.
5️. Accessing Array Elements
int[] numbers = {100, 200, 300};
[Link](numbers[0]); // 100
[Link](numbers[1]); // 200
[Link](numbers[2]); // 300
6. Loop Through an Array (using for)
int[] numbers = {2, 4, 6, 8};
for (int i = 0; i < [Link]; i++) {
[Link](numbers[i]);
}
7️. Loop through an Array (using while)
int[] numbers = {1, 3, 5, 7};
int i = 0;
while (i < [Link]) {
[Link](numbers[i]);
i++;
}
8️. Enhanced for Loop (for-each)
String[] fruits = {"Apple", "Banana", "Mango"};
for (String fruit : fruits) {
[Link](fruit);
}
📌 Best when you don’t need the index.
9️. Even and Odd Numbers Using Array
int[] nums = {1, 2, 3, 4, 5, 6};
for (int n : nums) {
if (n % 2 == 0) {
[Link](n + " is Even");
} else {
[Link](n + " is Odd");
}
}
10.. Find Sum and Average of Array Elements
int[] numbers = {10, 20, 30, 40};

4
Java, C, C++, Python and JavaScript Programming Language (High Level)
int sum = 0;
for (int n : numbers) {
sum += n;
}
double average = (double) sum / [Link];
[Link]("Sum = " + sum);
[Link]("Average = " + average);
11.. Array of Objects Example
class Student {
int id;
String name;
Student(int id, String name) {
[Link] = id;
[Link] = name;
}
}
public class Main {
public static void main(String[] args) {
Student[] students = new Student[2];
students[0] = new Student(1, "Sara");
students[1] = new Student(2, "John");
for (Student s : students) {
[Link]([Link] + " " + [Link]);
}
}
}
1️2. Key Points to Remember
Concept Explanation

Index Starts from 0

Same type All elements must be same data type

Fixed size Size cannot change after creation

.length Gets array size

✅ Summary
 Arrays store multiple values
 Faster access using index
 Fixed size
 Used with loops
else
Below is a clear and simple explanation of the else statement in Java, with easy examples.
1️. What is else in Java?

5
Java, C, C++, Python and JavaScript Programming Language (High Level)
The else statement is used together with if.
It runs only when the if condition is false.
2️. Basic if – else Example
int age = 15;
if (age >= 18) {
[Link]("You are eligible to vote.");
} else {
[Link]("You are not eligible to vote.");
}
📌 If the condition is false, the else block executes.
3️. Example: Pass or Fail
int marks = 40;

if (marks >= 50) {


[Link]("Pass");
} else {
[Link]("Fail");
}
4️. Example: Even or Odd (using else)
int number = 9;
if (number % 2 == 0) {
[Link]("Even number");
} else {
[Link]("Odd number");
}
5️. Example: Positive or Negative Number
int num = -5;
if (num > 0) {
[Link]("Positive number");
} else {
[Link]("Negative number or zero");
}
6️. Example with else if and else
int score = 72;
if (score >= 90) {
[Link]("Grade A");
} else if (score >= 75) {
[Link]("Grade B");
} else {
[Link]("Grade C or Fail");
}
📌 else here is the final option when no condition is true.
7️. Common Mistake ❌
if (age >= 18)
[Link]("Adult");
6
Java, C, C++, Python and JavaScript Programming Language (High Level)
else
[Link]("Minor");
✔ This works, but always use braces { } to avoid errors.
8️. Key Points to Remember
Point Explanation

else Executes when if is false

One else Only one else per if

Optional else is not mandatory

Order Always after if or else if

✅ Summary
 else provides an alternative action
 Used for decision making
 Makes programs clear and logical
1️. What is C?
C is a procedural programming language used to build:
 Operating systems
 Embedded systems
 Compilers
 High-performance applications
It is fast, powerful, and close to hardware.
2️. Basic Structure of a C Program
#include <stdio.h>
int main() {
printf("Hello, World!");
return 0;
}
Explanation:
 #include <stdio.h> → allows input/output
 int main() → program starts here
 printf() → prints output
 return 0; → program ends successfully
3️. Variables in C
int age = 25;
float salary = 10500.50;
char grade = 'A';
printf("%d\n", age);
printf("%f\n", salary);
printf("%c\n", grade);
4️. Data Types in C
Data Type Example
int int x = 10;
float float y = 5.5;

double double z = 10.25;


7
Java, C, C++, Python and JavaScript Programming Language (High Level)
Data Type Example

char char c = 'A';


5️. if – else in C
int marks = 45;
if (marks >= 50) {
printf("Pass");
} else {
printf("Fail");
}
6️. else if in C
int score = 85;
if (score >= 90) {
printf("Grade A");
} else if (score >= 75) {
printf("Grade B");
} else {
printf("Grade C");
}
7️. while Loop in C
int i = 1;
while (i <= 5) {
printf("%d\n", i);
i++;
}
8️. Even or Odd Number (C)
int num = 7;
if (num % 2 == 0) {
printf("Even number");
} else {
printf("Odd number");
}
9. Arrays in C
int numbers[5] = {10, 20, 30, 40, 50};
for (int i = 0; i < 5; i++) {
printf("%d\n", numbers[i]);
}
10. Functions in C
#include <stdio.h>
void greet() {
printf("Hello!");
}
int main() {
greet();

8
Java, C, C++, Python and JavaScript Programming Language (High Level)
return 0;
}
1️1. Summary of C Control Statements
Statement Purpose

Decision making

else Alternative path

else if Multiple conditions

while Looping

for Looping

switch Multiple choices

✅ Key Points
 C is case-sensitive
 Semicolon ; is mandatory
 main() is required
 Fast and efficient language
C++ Programming Basics (with Examples)
1️. What is C++?
C++ is an object-oriented programming language developed from C.
It supports:
 Procedural programming (like C)
 Object-Oriented Programming (OOP)
 Generic programming
Used for:
 System software
 Games
 Banking & financial systems
 Desktop applications
2️. Basic Structure of a C++ Program
#include <iostream>
using namespace std;
int main() {
cout << "Hello, World!";
return 0;
}
Explanation:
 #include <iostream> → input/output
 cout → output (print)
 return 0; → program ends
3️. Variables in C++
int age = 25;
float salary = 10500.50;
char grade = 'A';
string name = "Amanuel";

9
Java, C, C++, Python and JavaScript Programming Language (High Level)
cout << age << endl;
cout << salary << endl;
cout << grade << endl;
cout << name << endl;
4️. Data Types in C++
Type Example

int int x = 10;

float float y = 5.5;

double double z = 10.25;

char char c = 'A';

string string s = "Hello";

bool bool active = true;

5️. if – else in C++


int marks = 60;
if (marks >= 50) {
cout << "Pass";
} else {
cout << "Fail";
}
6️. else if in C++
int score = 85;
if (score >= 90) {
cout << "Grade A";
} else if (score >= 75) {
cout << "Grade B";
} else {
cout << "Grade C";
}
7️. Loops in C++
while Loop
int i = 1;
while (i <= 5) {
cout << i << endl;
i++;
}
for Loop
for (int i = 1; i <= 5; i++) {
cout << i << endl;
}
8️. Even or Odd Number (C++)
int num = 10;
if (num % 2 == 0) {
cout << "Even number";
} else {

10
Java, C, C++, Python and JavaScript Programming Language (High Level)
cout << "Odd number";
}
9️. Arrays in C++
int numbers[5] = {10, 20, 30, 40, 50};
for (int i = 0; i < 5; i++) {
cout << numbers[i] << endl;
}
10. Functions in C++
#include <iostream>
using namespace std;
void greet() {
cout << "Welcome!";
}
int main() {
greet();
return 0;
}
1️1. Classes and Objects (OOP Basics)
#include <iostream>
using namespace std;
class Student {
public:
int id;
string name;
void display() {
cout << id << " " << name << endl;
}
};
int main() {
Student s1;
[Link] = 1;
[Link] = "Sara";
[Link]();
return 0;
}

1. Simple meaning (everyday)


 If it rains, I stay home; else, I go to work.
👉 When it does not rain, the second action happens.
2. In programming
else is used together with if.
It defines the alternative action.
Rule
 If condition = true → if block runs
11
Java, C, C++, Python and JavaScript Programming Language (High Level)
 If condition = false → else block runs
3. Example (general idea)
if (condition is true)
do action A
else
do action B
4. Examples in real programming languages
Java / C / C++ / JavaScript
int age = 16;
if (age >= 18) {
[Link]("You can vote");
} else {
[Link]("You cannot vote");
}
👉 Since age is less than 18, the else part runs.
Python
age = 20
if age >= 18:
print("Adult")
else:
print("Minor")
5. Key points to remember
 else cannot exist alone
 It must come after an if
 It runs only when the if condition is false
 Used to handle two choices
Simple memory trick 🧠
if = when this is true
else = when it is not true

else if / elif meaning


It means “if the first condition is false, check another condition.”
Used when you have more than two choices.
1. General structure
Java / C / C++ / JavaScript
if (condition1) {
// runs if condition1 is true
} else if (condition2) {
// runs if condition1 is false AND condition2 is true
} else {
// runs if all conditions are false
}

12
Java, C, C++, Python and JavaScript Programming Language (High Level)
Python (elif)
if condition1:
# runs if condition1 is true
elif condition2:
# runs if condition1 is false and condition2 is true
else:
# runs if all conditions are false
2. Simple real-life example (marks)
Java / JavaScript
int mark = 75;
if (mark >= 85) {
[Link]("Grade A");
} else if (mark >= 70) {
[Link]("Grade B");
} else if (mark >= 50) {
[Link]("Grade C");
} else {
[Link]("Fail");
}
👉 Output: Grade B
Python
mark = 40
if mark >= 85:
print("Grade A")
elif mark >= 70:
print("Grade B")
elif mark >= 50:
print("Grade C")
else:
print("Fail")
👉 Output: Fail
3. Important rules
1. Conditions are checked from top to bottom
2. Only one block runs
3. Order matters (highest condition first)
4. else is optional but recommended
4. When to use what?
 if → one condition
 if–else → two choices
 if–else if–else → many choices

13
Java, C, C++, Python and JavaScript Programming Language (High Level)
5. Common beginner mistake ❌
if (mark >= 50)
else if (mark >= 70) // wrong order
✔ Correct order:
if (mark >= 70)
else if (mark >= 50)
Nested if–else meaning
A nested if–else means an if inside another if or else.
It is used when a decision depends on another decision.
👉 Decision inside a decision
1. General structure
if (condition1) {
if (condition2) {
// action A
} else {
// action B
}
} else {
// action C
}
2. Real-life example
If you pass the exam, then check your grade.
If you fail, stop there.
3. Example (Java / C / C++ / JavaScript)
int mark = 78;
if (mark >= 50) {
[Link]("You passed");
if (mark >= 80) {
[Link]("Excellent");
} else {
[Link]("Good");
}
} else {
[Link]("You failed");
}
Output:
You passed
Good
4. Same example in Python
mark = 45

14
Java, C, C++, Python and JavaScript Programming Language (High Level)
if mark >= 50:
print("You passed")
if mark >= 80:
print("Excellent")
else:
print("Good")
else:
print("You failed")
Output:
You failed
5. Nested if with logical meaning
Check age, then check license
Java example
int age = 22;
boolean hasLicense = true;
if (age >= 18) {
if (hasLicense) {
[Link]("You can drive");
} else {
[Link]("You need a license");
}
} else {
[Link]("You are too young");
}
6. Key rules to remember 🧠
1. Inner if runs only if outer if is true
2. Use nesting when conditions depend on each other
3. Too much nesting makes code hard to read
4. Sometimes else if is better than nesting
7. When to use nested if vs else if
Situation Use

Independent conditions else if

Dependent conditions nested if

WHILE LOOP (step-by-step and simple).


while loop meaning
A while loop repeats an action as long as a condition is true.
👉 If the condition becomes false, the loop stops.
1. Simple idea (real life)
 While the traffic light is red → wait
 While you have money → buy food
2. General structure

15
Java, C, C++, Python and JavaScript Programming Language (High Level)
Java / C / C++ / JavaScript
while (condition) {
// code to repeat
}
Python
while condition:
# code to repeat
3. Example 1: Count from 1 to 5
Java / JavaScript
int i = 1;
while (i <= 5) {
[Link](i);
i++;
}
Output:
1
2
3
4
5
Python
i=1
while i <= 5:
print(i)
i += 1
4. Example 2: Print even numbers (1–10)
int i = 2;
while (i <= 10) {
[Link](i);
i += 2;
}
5. Infinite loop (DANGER ⚠️)
If the condition never becomes false, the loop runs forever.
❌ Wrong:
int i = 1;
while (i <= 5) {
[Link](i);
}
✔ Correct:
i++;
6. Key rules to remember 🧠
1. Initialize variable before the loop

16
Java, C, C++, Python and JavaScript Programming Language (High Level)
2. Condition must become false
3. Update variable inside the loop
4. Used when number of repetitions is unknown
7. While vs If
if while
Runs once Runs many times
Decision Repetition
8. Common use cases
 Reading user input
 Menu systems
 Counters
 Waiting for a condition
If you want next, I can explain:
 for loop
 do–while loop
 arrays
 practice questions
Just say for, do-while, or array 😊
yes
Perfect! Let’s move to the FOR LOOP.
For Loop Meaning
A for loop repeats an action a specific number of times.
It’s used when you know how many times you want to repeat.
1. General structure
Java / C / C++ / JavaScript
for (initialization; condition; update) {
// code to repeat
}
 Initialization → start value
 Condition → loop runs while true
 Update → change value each iteration
Python
Python’s for loop works differently (over sequences):
for variable in range(start, end):
# code to repeat
2. Example 1: Count 1 to 5
Java / C / C++ / JavaScript
for (int i = 1; i <= 5; i++) {
[Link](i);
}

17
Java, C, C++, Python and JavaScript Programming Language (High Level)
Output
1
2
3
4
5
Python
for i in range(1, 6):
print(i)
Note: range(1,6) → 1 to 5 (6 is excluded)
3. Example 2: Print even numbers 2–10
Java
for (int i = 2; i <= 10; i += 2) {
[Link](i);
}
Python
for i in range(2, 11, 2):
print(i)

Part Two
Language Type / Level Main Use Cases Strengths Common DFS / Banking Use

Java High-level, OOP Enterprise apps, Android Secure, scalable, stable Core banking systems, payment platforms

Low-level, Procedural System programming Fast, efficient, hardware control ATM software, embedded payment devices

C++ Mid/High-level, OOP High-performance systems Speed, flexibility Trading systems, risk engines

Python High-level, Interpreted Data science, AI, automation Easy, powerful libraries Fraud detection, credit scoring

JavaScriptHigh-level, Scripting Web & mobile apps Interactive, full-stack Digital banking portals, wallets

1. Comparison Table
2. Simple Examples
Java Example
int balance = 1000;if (balance > 500) {
[Link]("Sufficient balance");
}
C Example
int balance = 1000;if (balance > 500) {
printf("Sufficient balance");
}
C++ Example
int balance = 1000;if (balance > 500) {
cout << "Sufficient balance";
}

18
Java, C, C++, Python and JavaScript Programming Language (High Level)
Python Example
balance = 1000if balance > 500:
print("Sufficient balance")
JavaScript Example
let balance = 1000;if (balance > 500) {
[Link]("Sufficient balance");
}
3. Use in Digital Financial Services (DFS)
Java is used to build secure and scalable core banking systems, payment gateways, and DFS back-end platforms.
C is used in ATMs, POS machines, and smart cards where direct hardware control is required.
C++ supports high-speed transaction processing, trading systems, and complex risk management engines.
Python is widely used for fraud detection, AML monitoring, credit scoring models, and data analytics.
JavaScript powers digital banking apps, mobile wallets, dashboards, and customer-facing DFS interfaces.
4. Best Choice by DFS Function
Core Banking / Payments → Java
ATM / POS Devices → C
Risk & Trading Systems → C++
Fraud & Credit Analytics → Python
Digital Channels (Web/App) → JavaScript
✅ JAVA (Enterprise & Core Banking)
Example 1: Balance Check
int balance = 2000;if (balance >= 1000) {
[Link]("Withdrawal allowed");
}
Example 2: Simple Transfer
int sender = 3000;int amount = 500;
sender -= amount;
[Link]("Remaining balance: " + sender);
Example 3: PIN Verification
int pin = 1234;if (pin == 1234) {
[Link]("Access granted");
}
Example 4: Daily Transaction Limit
int dailyLimit = 5000;int transaction = 2000;if (transaction <= dailyLimit) {
[Link]("Transaction approved");
}
✅ C (ATMs, POS, Embedded Systems)
Example 1: Balance Display
int balance = 1500;printf("Balance: %d", balance);
Example 2: Withdrawal Logic
int balance = 2000, withdraw = 500;
balance -= withdraw;printf("New balance: %d", balance);
Example 3: PIN Validation
int pin = 1111;if (pin == 1111)

19
Java, C, C++, Python and JavaScript Programming Language (High Level)
printf("Login successful");
Example 4: Transaction Count
int transactions = 0;
transactions++;printf("Transactions today: %d", transactions);
✅ C++ (High-Performance & Risk Systems)
Example 1: Account Class
class Account {public:
int balance = 3000;
};
Example 2: Deposit
int balance = 1000;
balance += 500;
cout << balance;
Example 3: Loan Eligibility
int income = 8000;if (income > 5000)
cout << "Loan approved";
Example 4: Transaction Fee
float amount = 1000;float fee = amount * 0.02;
cout << fee;
✅ PYTHON (Fraud, Analytics, Credit Scoring)
Example 1: Balance Check
balance = 2500if balance > 1000:
print("Eligible")
Example 2: Digital Loan Approval
credit_score = 700if credit_score >= 650:
print("Loan approved")
Example 3: Fraud Alert
amount = 20000if amount > 10000:
print("Suspicious transaction")
Example 4: Savings Automation
salary = 5000
savings = salary * 0.1print(savings
✅ JAVASCRIPT (Web & Mobile Banking Apps)
Example 1: Balance Display
let balance = 1800;[Link](balance);
Example 2: Payment Validation
let amount = 500;if (amount <= 1000) {
[Link]("Payment successful");
}
Example 3: OTP Verification
let otp = 4567;if (otp === 4567) {
[Link]("Verified");
}
Example 4: Online Transfer

20
Java, C, C++, Python and JavaScript Programming Language (High Level)
let sender = 3000;
sender -= 1000;[Link](sender);
🔹 Summary
Java → Core banking, DFS platforms
C → ATMs, POS, hardware-based systems
C++ → Risk engines, trading, performance systems
Python → Fraud detection, analytics, credit scoring
JavaScript → Mobile apps, internet banking, wallets

If you want next, I can show DFS system architecture, real banking mini-projects, or exam-ready notes 📘
EACH EXAMPES INCLUDE ''IF, ELSE, ELIF, WHILE'' AND ''INT, CHAR,
BOOLEAN, BYTE, FLOAT, SHORT, LONG, DOUBLE, STRING, SYSTEM'' FOR
EACH PROGRAM LANGUAGE AS 'MULTI VARIABLES''.
⚠ Note (important but brief):
elif exists only in Python (others use else if).
Data types differ by language (e.g., JavaScript has no int/byte, Python is dynamically typed).
I include equivalent or closest valid types while keeping the concept of multi-variables consistent.
✅ JAVA (Strongly Typed, DFS / Core Banking)
public class DFSExample {
public static void main(String[] args) {
int amount = 1000;
byte fee = 10;
short days = 30;
long accountNumber = 1234567890L;
float interest = 2.5f;
double balance = 5000.75;
char status = 'A';
boolean active = true;
String customer = "Enat Bank";
int i = 0;
if (balance > amount) {
[Link]("Sufficient balance");
} else {
[Link]("Insufficient balance");
}
while (i < days) {
i++;
}
[Link]("Customer: " + customer);
[Link]("Account Active: " + active);
}
}

✅ C (Procedural, ATM / POS Systems)


21
Java, C, C++, Python and JavaScript Programming Language (High Level)
#include <stdio.h>
int main() {
int amount = 500;
char status = 'A';
short days = 7;
long accountNumber = 987654321;
float interest = 1.5;
double balance = 3000.50;
int active = 1; // boolean equivalent
int i = 0;
if (balance > amount) {
printf("Transaction allowed\n");
} else {
printf("Transaction denied\n");
}

while (i < days) {


i++;
}
printf("Account Status: %c\n", status);
return 0;
}
✅ C++ (OOP + Performance, Risk Systems)- object oriented programming
#include <iostream>using namespace std;
int main() {
int amount = 1200;
short days = 15;
long accountNumber = 111222333;
float rate = 3.2f;
double balance = 8000.25;
char grade = 'G';
bool active = true;
string bank = "Digital Bank";
int i = 0;
if (balance > amount) {
cout << "Approved\n";
} else if (balance == amount) {
cout << "Exact balance\n";
} else {
cout << "Rejected\n";
}
while (i < days) {
i++;
}

22
Java, C, C++, Python and JavaScript Programming Language (High Level)
cout << bank << endl;
return 0;
}
✅ PYTHON (Analytics, Fraud, Credit Scoring)
(Includes real elif)
amount = 1000 # int
days = 10 # int
account_number = 12345 # long equivalent
interest = 2.5 # float
balance = 6000.75 # double equivalent
status = 'A' # char
active = True # boolean
bank = "DFS Bank" # string
i=0
if balance > amount:
print("Approved")elif balance == amount:
print("Exact amount")else:
print("Rejected")
while i < days:
i += 1
print(bank)
✅ JAVASCRIPT (Web & Mobile Banking)
(Uses JS equivalents)
let amount = 700; // int equivalentlet days = 5; // short equivalentlet accountNumber = 99999; //
long equivalentlet interest = 1.8; // float/doublelet balance = 4000.50;let status = "A"; // char
equivalentlet active = true; // booleanlet bank = "Mobile Wallet"; // string
let i = 0;
if (balance > amount) {
[Link]("Payment successful");
} else if (balance === amount) {
[Link]("Zero balance");
} else {
[Link]("Payment failed");
}
while (i < days) {
i++;
}
[Link](bank);
🔑 KEY LEARNING SUMMARY (EXAM-READY)
Java / C / C++ → Explicit data types (int, byte, short, long, float, double, char, boolean)
Python / JavaScript → Dynamic or unified numeric types (conceptually equivalent)
if / else / elif / while → Core control structures across all DFS systems
Multi-variables → Used to represent real DFS data (accounts, balances, status)

23
Java, C, C++, Python and JavaScript Programming Language (High Level)
In detail
Below is a more detailed, structured, and exam-ready explanation, with expanded logic, clear comments, and
DFS (Digital Financial Services) context for each programming language.
Each section includes multi-variables, data types, if / else / elif (where applicable), and while loops, explained
step by step.
1️. JAVA – Core Banking / DFS Back-End
📌 Purpose (DFS Context)
Used in core banking, payment switching, digital wallets, and enterprise DFS platforms.
public class DFSJavaExample {
public static void main(String[] args) {
// Multi-variable declarations
int transactionAmount = 1500;
byte transactionFee = 5;
short maxDays = 30;
long accountNumber = 123456789012L;
float interestRate = 2.5f;
double balance = 5000.75;
char accountStatus = 'A';
boolean isActive = true;
String bankName = "Digital Bank";
int day = 0;
// Decision making
if (isActive && balance >= transactionAmount) {
[Link]("Transaction Approved");
} else {
[Link]("Transaction Rejected");
}
// Loop for interest calculation days
while (day < maxDays) {
day++;
}
[Link]("Bank: " + bankName);
[Link]("Account: " + accountNumber);
}
}
🔍 Explanation
int, byte, short, long → transaction & account data
float, double → interest and balance precision
boolean → account status
if/else → approval logic
while → time-based processing (interest, limits)
2️. C – ATM / POS / Embedded DFS Systems
📌 Purpose (DFS Context)
Used in ATMs, POS terminals, smart cards, and hardware-level DFS devices.
24
Java, C, C++, Python and JavaScript Programming Language (High Level)
#include <stdio.h>
int main() {
int amount = 800;
short limitDays = 10;
long accountNumber = 567890;
float interest = 1.5;
double balance = 2500.50;
char status = 'A';
int active = 1; // Boolean equivalent
int i = 0;
if (active && balance >= amount) {
printf("Withdrawal Successful\n");
} else {
printf("Withdrawal Failed\n");
}
while (i < limitDays) {
i++;
}
printf("Account Number: %ld\n", accountNumber);
return 0;
}
🔍 Explanation
No native boolean → uses int
Very fast execution
Ideal for real-time transaction processing
Direct memory control → critical for devices
3️.C++ – Risk Engines / Trading / High-Performance DFS
📌 Purpose (DFS Context)
Used in risk management systems, liquidity engines, real-time trading platforms.
#include <iostream>using namespace std;
int main() {
int loanAmount = 5000;
short tenure = 24;
long customerID = 112233;
float interestRate = 3.2f;
double income = 12000.50;
char riskGrade = 'L';
bool eligible = true;
string product = "Digital Loan";
int month = 0;
if (income > loanAmount) {
cout << "Loan Approved\n";
} else if (income == loanAmount) {
cout << "Manual Review Required\n";

25
Java, C, C++, Python and JavaScript Programming Language (High Level)
} else {
cout << "Loan Rejected\n";
}
while (month < tenure) {
month++;
}
cout << "Product: " << product << endl;
return 0;
}
🔍 Explanation
else if for multi-condition risk logic
Combines speed + object-oriented design
Ideal for complex DFS calculations
4. PYTHON – Fraud Detection / Credit Scoring / Analytics
📌 Purpose (DFS Context)
Used for AI, fraud monitoring, AML, credit scoring, data analytics.
# Multi-variables
transaction_amount = 10000 # int
days = 7 # int
account_number = 998877 # long equivalent
interest_rate = 2.8 # float
balance = 15000.75 # double equivalent
status = 'A' # char
active = True # boolean
service = "Mobile Wallet" # string
i=0
if balance > transaction_amount:
print("Transaction Approved")elif balance == transaction_amount:
print("Exact Balance – Warning")else:
print("Transaction Rejected")
while i < days:
i += 1
print("Service:", service)
🔍 Explanation
Only language with real elif
Very readable
Excellent for rapid DFS innovation
Used heavily in regulatory reporting
5️. JAVASCRIPT – Digital Banking Apps / Wallets
📌 Purpose (DFS Context)
Used in mobile banking, internet banking, merchant portals, USSD backends.
let amount = 1200; // int equivalentlet days = 5; // short equivalentlet accountNumber = 445566; //
long equivalentlet interest = 1.9; // float/doublelet balance = 3000.50;let status = "A"; // char
equivalentlet active = true; // booleanlet appName = "Mobile Banking";

26
Java, C, C++, Python and JavaScript Programming Language (High Level)
let i = 0;
if (active && balance > amount) {
[Link]("Payment Successful");
} else if (balance === amount) {
[Link]("Zero Balance Alert");
} else {
[Link]("Payment Failed");
}
while (i < days) {
i++;
}
[Link]("App:", appName);
🔍 Explanation
Single Number type for all numerics
Runs in browser & server ([Link])
Powers DFS user interfaces

Each example includes multi-variables, data types, if / else / else if (elif in Python), and while loops, written in a
way suitable for exams, training, and DFS understanding.
✅ 1. JAVA — Core Banking / DFS Backend
Example 1: Transaction Approval
int amount = 1000;double balance = 5000.50;boolean active = true;
if (active && balance >= amount) {
[Link]("Approved");
} else {
[Link]("Rejected");
}
Example 2: Daily Limit Check
int limit = 3000;int used = 1500;
if (used < limit) {
[Link]("Within limit");
} else {
[Link]("Limit exceeded");
}
Example 3: Interest Loop
float interest = 2.5f;short days = 5;int i = 0;
while (i < days) {
i++;
}
Example 4: Multi-Variables
int id = 101;long accNo = 123456789L;char status = 'A';String bank = "DFS Bank";

[Link](bank);

✅ 2. C — ATM / POS / Embedded DFS


27
Java, C, C++, Python and JavaScript Programming Language (High Level)
Example 1: Withdrawal
int amount = 500;double balance = 2000.0;
if (balance >= amount)
printf("Success");else
printf("Fail");
Example 2: PIN Validation
int pin = 1234;
if (pin == 1234)
printf("Access");else
printf("Denied");
Example 3: Loop Counter
short days = 3;int i = 0;
while (i < days) {
i++;
}
Example 4: Multi-Variables
int id = 10;long acc = 98765;char status = 'A';float rate = 1.5;
✅ 3. C++ — Risk / Trading / Performance Systems
Example 1: Loan Decision
double income = 8000;double loan = 4000;
if (income > loan)
cout << "Approved";else
cout << "Rejected";
Example 2: else if Logic
int score = 650;
if (score > 700)
cout << "Low Risk";else if (score >= 600)
cout << "Medium Risk";else
cout << "High Risk";
Example 3: While Loop
short months = 6;int i = 0;
while (i < months) {
i++;
}
Example 4: Multi-Variables
int id = 1;long acc = 12345;bool active = true;
string product = "Digital Loan";
✅ 4. PYTHON — Fraud / Credit / Analytics
(Includes real elif)
Example 1: Balance Check
balance = 5000
amount = 2000
if balance > amount:
print("Approved")else:

28
Java, C, C++, Python and JavaScript Programming Language (High Level)
print("Rejected")
Example 2: Credit Score
score = 650
if score >= 700:
print("Low Risk")elif score >= 600:
print("Medium Risk")else:
print("High Risk")
Example 3: While Loop
days = 5
i=0
while i < days:
i += 1
Example 4: Multi-Variables
acc = 12345
rate = 2.5
active = True
bank = "Mobile Bank"
✅ 5. JAVASCRIPT — Mobile / Internet Banking
Example 1: Payment
let balance = 3000;let amount = 1000;
if (balance >= amount) {
[Link]("Paid");
} else {
[Link]("Failed");
}
Example 2: else if
let score = 620;
if (score > 700) {
[Link]("Low Risk");
} else if (score >= 600) {
[Link]("Medium Risk");
} else {
[Link]("High Risk");
}
Example 3: While Loop
let i = 0;while (i < 5) {
i++;
}
Example 4: Multi-Variables
let acc = 9999;let active = true;let rate = 1.8;let app = "Digital Wallet";
🔑 FINAL SUMMARY (EXAM-READY)
if / else / while → used in all languages
elif → Python only
Multi-variables → represent DFS data (accounts, balance, risk, status)

29
Java, C, C++, Python and JavaScript Programming Language (High Level)
Java/C/C++ → strong typing (int, long, float, double, char, boolean)
Python/JavaScript → dynamic typing (conceptual equivalents)

Console
Console means a text-based interface where a program displays output and sometimes receives input from the
user.
In programming, the console is used mainly for printing messages, results, errors, and logs so developers can see
what the program is doing. It is not a graphical screen; it shows plain text only.
Console in different languages (simple meaning)
Java → [Link]() prints text to the console
C / C++ → printf() or cout prints text to the console
Python → print() shows output in the console
JavaScript → [Link]() prints messages to the browser or system console
Simple example
print("Transaction successful")
This line sends the message “Transaction successful” to the console.
In Digital Financial Services (DFS)
The console is used to:
Display transaction results
Show error messages
Log system activities for debugging
Test banking logic before deploying real systems
In short:
👉 The console is where a program “talks” to the developer using text.
The full name of “console” in programming is:
Console = Control + Output + System Environment
In practical and commonly accepted usage, Console refers to a Command-Line Interface (CLI) or System
Console, which is a text-based interface provided by the operating system for input and output operations.
Examples of console usage:
Java: [Link]() → prints to the System Console
JavaScript: [Link]() → prints to the Browser Developer Console.
Python: print() → prints to the Terminal / Console
✅ Important note:
“Console” does not have an official single-word acronym full form in computer science. It is a technical term, not
an abbreviation.

What is threshold?
A threshold is a defined limit, boundary, or minimum/maximum level at which a condition changes, an action
is triggered, or a decision must be made.
In risk management, a threshold represents the point beyond which risk becomes unacceptable and requires
immediate attention or corrective action.
In general use, a threshold can mean the minimum requirement needed to enter, start, or qualify for something
(for example, a pass mark in an exam or a minimum balance in an account).

30
Java, C, C++, Python and JavaScript Programming Language (High Level)
Example:
If a bank sets a liquidity threshold of 20%, falling below this level triggers management actions such as raising
funds or reducing lending.
2nd definition
A threshold is a predefined limit or boundary that determines when a certain action, response, or condition
should occur. It represents the point at which something changes or triggers an event.
In different contexts:
1. Risk Management / DFS:
o A threshold is the maximum level of risk, loss, or exposure that is considered acceptable.
Exceeding it requires corrective actions.
o Example: “If non-performing loans exceed a 5% threshold, the bank must take remedial
measures.”
2. General / Everyday Use:
o A threshold is the minimum level needed for something to happen.
o Example: “The minimum deposit threshold to open a digital savings account is $10.”
3. Technical / Systems:
o In programming or sensors, a threshold is a value that triggers an action.
o Example: “If temperature > 50°C (threshold), the system sends an alert.”
✅ Summary:
A threshold is the point or limit that separates normal from action-required conditions.

Bed Room Bed Room


3m x 1.6m 3m x 1.6m

=4.8m2 =4.8m2 31
Java, C, C++, Python and JavaScript Programming Language (High Level)

32

You might also like