Vous êtes sur la page 1sur 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;

Vous aimerez peut-être aussi