Java Programming: Conditional Statements and Loops, Lecture notes of Computer System Design and Architecture

An example of java code demonstrating the use of conditional statements (if-else) and loops (while). The code includes instructions on how to declare variables, determine letter grades, and create conditions using boolean values. It also covers the rules of using if statements and java's while loop.

Typology: Lecture notes

2018/2019

Uploaded on 03/06/2019

shawn-chilton
shawn-chilton 🇺🇸

1 document

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
//declare variabes
//determine letter grade
13- C3
//declare varaibles
2 acccept pacakge type
paca
3 accept
4 calculate bill
if package = A
____________
review chapter 3 4 5
6
________________
ch4 loops...
[LEARN RULES OF IF STATEMENT + and java rules..]
!BOOLEAN IS EITHER TRUE OR FALSE!
any type of loop with paranetheseis can put it in
while ( )
condition loop true or false
how to create condition is = boolean
"boolean b = false";
if(b [can put boolean here[stick variable name]] )
{
=
-
IF FALSE NOT TRUE WONT EXCECUTE condition
if BOOLEAN condition is true it will execute
OR
int x = keyboard.textInt();
if(x>10)
}
EXAMPLE
intx=1
while(x<=20 )
{
system.out.printin("dante")
x++;
}
/////
pf2

Partial preview of the text

Download Java Programming: Conditional Statements and Loops and more Lecture notes Computer System Design and Architecture in PDF only on Docsity!

//declare variabes

//determine letter grade

13- C

//declare varaibles 2 acccept pacakge type paca

3 accept

4 calculate bill if package = A


review chapter 3 4 5 6


ch4 loops... [LEARN RULES OF IF STATEMENT + and java rules..] !BOOLEAN IS EITHER TRUE OR FALSE! any type of loop with paranetheseis can put it in

while ( ) condition loop true or false how to create condition is = boolean

"boolean b = false"; if(b [can put boolean here[stick variable name]] ) { =

IF FALSE NOT TRUE WONT EXCECUTE condition if BOOLEAN condition is true it will execute

OR

int x = keyboard.textInt(); if(x>10) }

EXAMPLE intx= while(x<=20 ) { system.out.printin("dante") x++; }

public class Temperature { private double ftemp;

public Temperature (double f) { fTemp = fgiven;

public void setFarenheit() { return ftemp;

public double getFarenheit() }

public double getKelvin() {

Temperature temp1 = new Temperature(userFahrenheitTemperature); // ( VARIABLE )