SCANNER CLASS(Methods)
DIALOG BOXES
Message Dialogs
INPUT DIALOGS
Disadvantage of JOptionPane
Methods for converting strings to numbers
DECISION / CONTROL FLOW STRUCTURES
IF STATEMENT
IF STATEMENT SYNTAX
Flow of If statements
If-else Statement
If –else statement SYNTAX
Logic of if-else Statement
NESTED IF STATEMENT
Nested if statement SYNTAX
Std 12 computer java basics part 3 control structureNuzhat Memon
Std 12 Computer Chapter 7 Java Basics (Part 3) by Nuzhat Memon
Block in java
Control structures in java
Branches in java
if statement
switch statement
loops in java
for loop
while loop
do while loop
break statement and continue statement
gseb computer paper solution 2020 english medium
Std 12 computer java basics part 3 control structureNuzhat Memon
Std 12 Computer Chapter 7 Java Basics (Part 3) by Nuzhat Memon
Block in java
Control structures in java
Branches in java
if statement
switch statement
loops in java
for loop
while loop
do while loop
break statement and continue statement
gseb computer paper solution 2020 english medium
OOP Course " Object oriented programming" using java technology , slide is talking about the Java langauge Basics which need to be understood to start learning OOP
Python tutorial notes for all the beginners. It is covered with core topics in python with example programs. It is useful for all types of students (school, college (lower and higher level)) and also for teachers, lecturers, assistant professors, and professors.
Complete Information till 2D arrays. In this slides you can also find information about loops and control decision....
Best slides for beginners who wants to learn about C programming language..
ATCs’ library system is operated manually by group of people as the manual library system is explained by Ross, Brooks (1992) where many people are involved in the process of managing the library in such a way that to keep records regarding the books & students (borrowers), check the books manually, keep records on issued books, all these things are carried out manually the library has a large content and handling it is also a problem. On the other hand ATC keeps a lot of maintenance workers which costs a lot & it is not efficient for a library. Manual record keeping is also not a reliable method as people tend to forget things. On the borrower’s point of view, in manual system borrower can’t find a book exactly at once as they are not ordered well. Sometimes user might be searching for a book that is not available in the library in such situations people get annoyed or depressed. Therefore there should be a reliable way to manage the library system.
OOP Course " Object oriented programming" using java technology , slide is talking about the Java langauge Basics which need to be understood to start learning OOP
Python tutorial notes for all the beginners. It is covered with core topics in python with example programs. It is useful for all types of students (school, college (lower and higher level)) and also for teachers, lecturers, assistant professors, and professors.
Complete Information till 2D arrays. In this slides you can also find information about loops and control decision....
Best slides for beginners who wants to learn about C programming language..
ATCs’ library system is operated manually by group of people as the manual library system is explained by Ross, Brooks (1992) where many people are involved in the process of managing the library in such a way that to keep records regarding the books & students (borrowers), check the books manually, keep records on issued books, all these things are carried out manually the library has a large content and handling it is also a problem. On the other hand ATC keeps a lot of maintenance workers which costs a lot & it is not efficient for a library. Manual record keeping is also not a reliable method as people tend to forget things. On the borrower’s point of view, in manual system borrower can’t find a book exactly at once as they are not ordered well. Sometimes user might be searching for a book that is not available in the library in such situations people get annoyed or depressed. Therefore there should be a reliable way to manage the library system.
It exists.
It takes time.
It requires culture and discipline.
Unit and function testing is what takes the least time.
Hours writing an automated test is time invested, not time wasted!
learn how to program with python
from scratch to be an expert
use the link in the first slide to get the full course
here is the link if you want : https://oke.io/JdxdUl
the link of the documentation : https://oke.io/J6DeY3
link to download python : https://oke.io/BENgRLR2
This presentation discusses the basics of Variables and Arithmetic operations in Visual Basic, together with information on debugging resources within the program
4. SSCCAANNNNEERR CCLLAASSSS((MMeetthhooddss))
For example:
int number;
Scanner keyboard= new Scanner(System.in);
System.out.print(“Enter an integer value”);
number= keyboard.nextInt();
Therefore, this statement formats the input
that was entered @ the keyboard as an
int.
5. SSCCAANNNNEERR CCLLAASSSS((MMeetthhooddss))
nextByte – returns input as Byte
nextDouble – returns input as Double.
nextFloat – returns input as Float
nextInt – returns input as an Int
nextLine – return input as String.
nextLong – return input as a long
next Short – return input as a short.
7. DDIIAALLOOGG BBOOXXEESS
CONCEPT:
JOptionPane class allows a user to display
a Dialog Box.
Dialog Box – is a small graphical window
that displays a message to the user or
request input. We can quickly display
dialog boxes w/ JOptionPane class.
8. DDIIAALLOOGG BBOOXXEESS
Types of DIALOG BOXES
Message Dialog – a dialog box that
displays a message; an OK button is also
displayed.
Input Dialog – dialog box tat prompts the
user for input & provides text field where
input is typed; an OK button and a
CANCEL button are also displayed.
9. DDIIAALLOOGG BBOOXXEESS
Beginning Statement in your code when
using JoptionPane:
import javax. swing.JOptionPane;
Purpose: this statement tells the compiler
where to find the JOptionPane class, and
make it available to your program.
10. MMeessssaaggee DDiiaallooggss
showMessageDialog method- is used to display a
message dialog box.
Statement to call the method:
JOptionPane.showMessageDialog (null, “HELLO WORLD”);
ARGUMENT PURPOSE:
null – causes the dialog box to be displayed in the center of the
screen.
HELLO WORLD – the message we want to display in the dialog
box.
11. IINNPPUUTT DDIIAALLOOGGSS
showInputDialog method – to display an input
dialog in JOptionPane class.
Statement to call the method:
String name;
name = JOptionPane.showInputDialog(“Enter your name.”);
12. SSaammppllee CCooddee
import javax.swing.JOptionPane;
public class Names {
public static void main (String [ ] args)
{
firstName= JOptionPane.showInputDialog(“What’s your firstname”);
middleName=JOptionPane.showInputDialog(“What’s your middle name”);
lastName=JOptionPane.showInputDialog(“What’s your Last Name”);
JOptionPane.showMessageDialog(null, “HELLO” +firstName + “ “ +
middleName + “ “ + lastName);
System.exit (0); This statement causes the program to end, & is
required if we use the JOptionPane class to display dialog
box.
} }
13. DDiissaaddvvaannttaaggee ooff JJOOppttiioonnPPaannee
JOptionPane class does not have different
methods for reading values of different data
types as input.
showInputDialog method always returns the
user’s input as a String.
Problem when use in Math operation.
Because we cannot perform math on strings.
In such case, you must convert the input to a numeric
value.
14. Methods ffoorr ccoonnvveerrttiinngg ssttrriinnggss ttoo nnuummbbeerrss
Byte.parseByte – method to convert string to a
byte.
Double.parseDouble – method to convert string
to a double.
Float.parseFloat – method to convert string to a
float.
Integer.parseInt – method to convert string to
an int.
Long.parseLong – method to convert string to a long.
Short.parseShort – method to convert string to a
short.
15. SSaammppllee UUssaaggee
int num;
String str;
str=JOptionPane.showInputDialog(“Enter a number”);
num= Integer.parseInt(str);
num variable will hold the value entered by
the user, converted to an int.
17. IIFF SSTTAATTEEMMEENNTT
CONCEPT:
> is used to create decision structures,
which allow the program to have more
than one path of execution
> causes one or more statements to
execute only when boolean expression
is true.
NOTE: RELATIONAL OPERATIONS ARE USED
18. IIFF SSTTAATTEEMMEENNTT SSYYNNTTAAXX
If (BooleanExpression)
statement;
BooleanExpression- appears inside the
parentheses must be a boolean
expression.
If the boolean expression is true, the next
statement is executed.
20. SSAAMMPPLLEE UUSSAAGGEE
PROBLEM:
If the value is less than 32, displays the
message “Invalid Number”
CODE:
if ( value < 32)
System.out.println(“Invalid Number”);
21. IIff--eellssee SSttaatteemmeenntt
Concept:
> will execute one group of statements if
its BOOLEAN EXPRESSION is True, or
another group if its BOOLEAN
EXPRESSION is False.
> expansion of the if statement.
26. TTHHEE iiff--eellssee--iiff SSttaatteemmeenntt
CONCEPT:
if-else-if statement test a
series of conditions than with
a set of nested if-else
statement.
else-if statement is in between
the if & else statement.
27. SSyynnttaaxx ooff iiff--eellssee--iiff SSttaatteemmeenntt
if(BooleanExpression){
statement;
}
else if(BooleanExpression){
statement;
}
else{
statement;
}
main test
Alternative
test if the if
statement is
false
28. LLOOGGIICCAALL OOPPEERRAATTOORRSS
Java provides two binary operators,
&& and ||, which are used to
combine two boolean expressions
into a single expression.
Java also provides the unary !
operator, which reverses the truth
of a boolean expression.
31. LLOOGGIICCAALL OOPPEERRAATTOORRSS IINN OORRDDEERR OOFF
PPRREECCEEDDEENNCCEE
1st = !
2nd=&&
3rd= ||
Note: ! Operator has higher precedence than
many of Java’s other operators.
You should enclose its operand in () unless
you intend to apply it to a variable or simple
expression w/ no other operators.
32. EExxaammppllee UUssaaggee
Assume x is an int w/ a value stored in it:
! (x >2)
read as “ is x not greater than 2?”
!x>2
read as “ is logical complement of x is
greater than 2? ”
Note: ! operator can be applied only to boolean
expressions.
33. SSwwiittcchh SSttaatteemmeenntt
CONCEPT:
switch statement lets the value of a
variable or expression determine where
the program will branch to.
is a multiple alternative decision
structure.
can be used as an alternative of if-else-if
statement that test the same variable w/
several different values.
35. SSwwiittcchh ssttaatteemmeenntt ssyynnttaaxx
switch(variable)
{
case value_1:
statement;
break;
case value_N : statement;
break;
default :
statement;
break;
}
These statement is executed if
the variable is equal to value_1
These statement is executed if the
variable is equal to value_N.
These statement is executed if
the variable is not equal to
any of the case values.
36. SSaammppllee UUssaaggee((fflloowwcchhaarrtt eexxaammppllee))
switch(month)
{
case 1:
System.out.print(“January”);
break;
case 2:
System.out.print(“February”);
break;
case 3:
System.out.print(“March”);
break;
default:
System.out.print(“Error:”);
break;
}