FinCheck Conditional Logic for Transaction Validation
Business Scenario
After Successfully understanding Variables, Data Types, and Operators inside Java Programs, your manager now assigns you responsibility for validating Transaction Conditions inside the FinCheck Banking System.
During Banking Transaction Processing, the system continuously checks multiple Conditions before allowing transactions.
Recently, FinCheck Users reported several Validation-Related Issues :-
Transactions Processed with Insufficient Balance
Negative Transaction Amounts Accepted
Inactive Accounts Allowed Transactions
Invalid Transaction Types Processed Successfully
Before starting validation activities, your manager clearly says :-
“A QA Tester must understand how applications make Decisions using Conditions and Validations. ”
Your responsibility is to understand :-
How Conditional Statements Work
How Transaction Validations are Performed
How Valid and Invalid Scenarios are Handled
How Java Programs Make Decisions
How Testing Conditions are Verified inside Applications
Pre-Lab Preparation
Task 2: Understand if-else Validation
Understand if Condition
a
What is if Condition?
if condition is used to execute code only when specified condition becomes true.
QA testers use conditions to validate :-
transaction amount
account balance
transaction type
account status
How if Condition Works
Condition gets checked.
1. If condition becomes true :- program executes validation block.
2. If condition becomes false :- program skips validation block.
Real Life Example
Transaction amount = 5000
If amount is greater than 0 :- transaction becomes valid.
Syntax
if (conditional) {
// run code with condition is true
}If condition
Activity
Create transaction amount variable and assigned 10000 in it.
Apply if condition to validate transaction amount should be greater than 0
Print validate result
Execute java program
Task 2: Understand if-else Validation
Understand if-else Condition
a
What is if-else Condition?
if-else condition handles both valid and invalid scenario
Here Else will only run when if condition is not true.
How if-else Works
If condition becomes true :-
valid block executes.
Otherwise :-
else block executes.
Real Life Example
If balance available :-
transaction allowed.
Else :-
transaction rejected.
System.out.print("VariableName");Syntax
Stores decimal values with larger precision.
Stores very small whole numbers.
Stores small numeric values.
Stores whole numbers.
Stores very large whole numbers.
Non primitive Data Types
Non-primitive data types store multiple values or complex information.
Types of non-primitive Data Types
String
Stores text values.
Array
Stores multiple values inside single variable.
Class
Used to create objects and program structure.
Real Life Example
Tester stores :-
customer name using String
transaction amount using int
balance using double
Syntax
Refer variable declaration syntax
Activity
Create variables using multiple data types
Store transaction values
Print stored output
Task 3: Understand Java Operators
Understand Operators
a
What are Operators?
Operators are symbols used to perform calculations and operations inside Java programs.
QA testers use operators during :-
balance calculations
transaction validations
amount verification
testing logic execution
Types of Operators
Arithmetic Operator
Arithmetic operators are used to perform mathematical calculations inside Java programs.
Types of Arithmetic Operators
Addition Operator (+)
Subtraction Operator (-)
Multiplication Operator (*)
Division Operator (/)
Modulus Operator (%)
Comparison Operators
Comparison operators are used to compare two values.
These operators return result as :- true or false
Types of Comparison Operators
Equal To Operator (==)
Greater Than Operator (>)
Less Than Operator (<)
Greater Than Equal To (>=)
Less Than Equal To (<=)
Logical Operators
Logical operators are used to combine multiple conditions.
Types of Logical Operators
2. OR Operator (||)
At least one condition must be true otherwise if all conditions are false then end result will be false
1. AND Operator (&&)
Both Condition must be true then end result will be true otherwise always it will be false
NOT Operator (!)
Reverses the result
Real Life Example
Customer balance = 10000
Withdrawal amount = 2000
Updated balance = 8000
Activity
Create balance variable
Create withdrawal amount variable
Perform subtraction operation
Display updated balance
Task 4: Perform Transaction Calculations
Understand Transaction Calculations
a
What is Transaction Calculation?
Transaction calculation means updating balance after debit or credit transaction.
Banking applications perform calculations whenever transaction occurs.
Types of Transaction Calculations
Debit Calculation
Amount gets deducted from balance.
Credit Calculation
Amount gets added to balance.
How Transaction Calculation Works
System reads current balance.
Transaction amount gets processed.
Updated balance gets calculated.
Output displays inside console.
Real Life Example
Current balance = 15000
Debit amount = 5000
Remaining balance = 10000
Activity
Debit Transaction
Create balance variable
Create debit amount variable
Create remaining balance variable
Perform subtraction calculation
Store calculation value into remaining balance variable
Display remaining balance
Activity
Credit Transaction
Create balance variable
Create credit amount variable
Create update balance variable
Perform addition calculation
Store calculation value into update balance variable
Display updated balance
Good Job!!
In this lab, you learned Java Variables, Data Types, and Operators used for transaction calculations and validations.
You also practiced Storing Transaction Data, performing Calculations, and Verifying Console Output.
By completing this lab, you now understand how QA Testers Handle Data and Validate Transaction Outputs using Java.
Checkpoint
Next-Lab Preparation
Git Push
git push origin branchName