0% found this document useful (0 votes)
108 views2 pages

css4 Presentation

1) The document discusses different types of control flow statements in Java including if-else statements, switch statements, and nested if statements. 2) An if-else ladder statement is described as a multi-branch conditional statement. 3) A sample switch statement is provided to calculate monthly bank account interest based on the balance and interest rate.
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)
108 views2 pages

css4 Presentation

1) The document discusses different types of control flow statements in Java including if-else statements, switch statements, and nested if statements. 2) An if-else ladder statement is described as a multi-branch conditional statement. 3) A sample switch statement is provided to calculate monthly bank account interest based on the balance and interest rate.
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/ 2

COMPUTER

SYSTEM
SERVICING 4
if –If else
else – if ladder statement
Nested
Switch ( Controlling_Expression)
The Switch
Multi-Branch If
If –Statement
Statement
else Statement
If
{ (balance > 0) statement
. .System.out.println(“Positive
. balance”);
If
{ (balance
else
The following >= java
0)
SwitchIf (balance < 0)
(expression){
statement,
If ( INTEREST_RATE known
System.out.println(“Negative
Case value 1:
as>=an 0)if – else
balance”); statement:
False
(BANK’S
// code balance
else = balance + PROGRAM)
C1 to beACCOUNTING
executed; ( INTEREST_RATE *
break; If (balance == 0) False
//optional
balance
IfCase
(balance
value 2
/ 12;
>=C2 0)
System.out.println(“Zero balance”);
False
else
If
//(balance
balance
code to be >= executed;
0)
= balance + ( INTEREST_RATE *
C3
{break; //optional
balance)
If
…… ( /
INTEREST_RATE 12:
System.out.println(“Cannot
>= 0) have a
negative
else
Default: interest.”);
balance = balance + ( INTEREST_RATE * balance)/12;
Flow of
codeS1
else to be executed
S2 if all cases S3
are not matches;S4
else
balance = balance Control
} System.out.println(“cannot
Branching
–have a negative interest.”);
balance
}
OVERDRAWN_PENALTY;
True = balance
TrueStatement
If -Statement
OVERDRAWN_PENALTY;
True
else
Is balance
the order Nextwhich
= balance Statement a program Performs
- OVERDRAWN_PENALTY;

You might also like