Escolar Documentos
Profissional Documentos
Cultura Documentos
!
!
"
#
Slides_Java_3
&% !
"
"
$'
(
)
*
,3
, *
+ %
$ - %) *
+ $. / 0 12
4 $
$
5
!
!!
"
"
6
#
78
%!
"
"
$'
#
9
= ;
#
< &%
!!
>> = < 4
$ $
!% %
"
"
$'
/
$ $
B #
5
%?
A%
$
9
!!
9 C
C
#
#
C!!
$
%'%
"
"
#
"
"
Exemplo (n=5):
*****
*****
*****
*****
*****
"
%D
4%
Preo
P>10000
5000 < P <= 10000
2500 < P <= 5000
outros
Desconto
40%
20%
10%
5%
$'
B #
59
%?
&%
$
' $G
5;
' $
5 ;
' $9
#
#
' $;
$
%H
$
%J
$
$
%!
%!
!%
K
"
"
$'
) )
)
#
(:
B #
#
B #
#
#
(:
"
"
%L
apresenta a tangente.
$
$
'
#
#
%L
$
B #
%L
$
$
!
$
$
' ! '
MM
'
$ $
%H
' ! ' ! '
$
%
:
!
$
%?
$
%8 N
O
' ! '
.
%!
%!
%!
MM
4%
'
(:
'
6< $
' ! '
Grau
Seno
Coseno
Tangente
0
30
60
90
120
150
180
...
0.00
0.50
0.87
1.00
0.87
0.50
0.00
1.00
0.87
0.50
0.00
-0.50
-0.87
-1.00
0.00
0.58
1.73
16331239353195370.00
-1.73
-0.58
-0.00
import java.text.*;
public class SinCos{
public static void main (String[] args){
DecimalFormat df = new DecimalFormat("0.00");
System.out.println("Grau\tSeno\tCoseno\tTangente\n");
for( int d=0; d <= 360; d +=30){
System.out.print( d + '\t');
System.out.print( df.format(Math.sin(d*(Math.PI/180))) + '\t');
System.out.print( df.format(Math.cos(d*(Math.PI/180)))+ '\t');
System.out.print( df.format(Math.tan(d*(Math.PI/180)))+ '\t');
System.out.println();
}
} // main method
} // SinCos class
Exemplo:
8 23 45 2 56 3 7 12 38 43
Maior=56
Menor=2
Exemplo:
input = 12
divisores = 1, 2, 3, 4, 6, 12
Converte graus
para radianos
$'
9
8
)
)
9
#
!!
$ $
B #
66
P& %
"
66
66
8
8
3$ 3$
)
)
5
"
#
#
$
$
$
$
%+
%+
P
P
E
E
&% !
&% !
"
"
$'
Exemplos:
input: x=4, y=8 ----- result = 12
input: x=3, y=9 ----- result = 27
input: x=4, y=11 ----- result = 11
)
#
B #
#
&%
$
$
9
=
%+
%!
!% @ %
!!
#
"
"
$'
#
9
#
$'
9)
$ $
B #
$ $
B #
9=
%9P 1P& %
$
% P 1P& %
$
#
9
#
9)
$ $
B #
$ $
B #
9=
=
#
4
#
#
%/
%9P N
%/
%9P N Q
$.
) PNQ
@ Q
) PN
& %!
9!
$.
& %!
66
$.
& %!
9'
$.
& %!
%9P 1P& %
$
% P 1P& %
$
>>
=
#
$ $
%/
9= 4 > >
= 4
#
$ $
%/
N
)
N
)))) :
94
66
9N Q
#
$ $
9
66
N Q
#
$ $
$.
@ Q
N
& %!
$.
& %!
9!
9'
$$$
"
"
"
$'
$ $
B #
%?
>>
A%
= G
$
= 9
%+
4
%!
MM
!%N
%+
%!
!%N
%L
= G
-
%
%
"
"
$'
(
) )
)
#
B #
#
B #
#
%L
%L
$
$
B #
5
5
5
"
"
"
5
5
"
"
"
#
#
$
$
$
$
%8
%8
%!
%!
"
"
$'
) C) R
66
C 9
66
#
$ $
#
$ $
R
#
$$
9 $$
K
K9
!% %
C!% %
!!
! C
$ $
R!% %
C
R
C
"
"
"
$'
)
(
#
B #
; $
$
%?
&%
$
9
!!
F 6
$
66
%J
(
F
%! !%
%!
"
#
%J
%!
"
"
$'
66 J
Exemplos:
43 -> 7
432 -> 9
3271 -> 13
#
,3
$ $
B #
5
&7
S!
$
!
69
= 9
"
#
"
"
random()- Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0.
floor(double a) - Returns the largest (closest to positive infinity) double value that is not greater than the
argument and is equal to a mathematical integer.
3$
T'8
3$
!9
!"
8 #0
(
$
3$
T '8
!%%
,3
4 T
8
(
$
3$
!!
3$
T '8
3$
Eis a estrutura:
1.
2.
3.
!9
!9
!%%
"
#
9
8
% %!
!%
1.
"
2.
"
1.
3.
4.
$'
8 #2
66
8
#
O
(1
$ $
2
,3
2
#
U
8
%?
B #
$
$
3$
(1
(1
%
$$$%
- $$$%
%?
B #
"
#
"
"
!9
4 8
2
58
$ $
9 9 &
9 '8 3$
&%
%/ J . H + V 4%
&%
gt 2
2
_ radians = 180
$
$
$
$'
$'
8 #D
8 #D
)
#
B #
#
%
0
%
0
B #
'8
3$D 69W
3
C
C$ / -
C
)
$
$
%
E
$
0
$ $
%
E
B #
$
0
'8 3$D 69W
66
2
3
C
, 2
3
C$ / ) G ) ) 9;
&%
&%
66
, 2
3
) G ) ) 9;
$;
X $W
#
C$ D
$$$$
,3
C$
&%
B #
-) #
"
"
"
#5
!
' '8
#
' '8
C$ D
&%
66
-) #
66
3$
3$
-) #
"
"
"
&'()*'(
10
"
$'
D
)
(
#
B #
%?
Incrementa N por 2 (N = N + 2)
Calcula R (R = P % N)
A%
9 MM
(
=
(
66
66
<
=
,3
>>
3$ :
!
=
Se R 0 P
um nmero Primo!
Caso contrrio, P no primo.
"
4
(
(
"66
(
#
%+
%! !% N
%+
%! !% 1Y + N
D
O
4%
D
$$$%
"
"
)-
%?
B #
Exemplo:
#
#
input: 1234
result: 4321
"
,3
&%
$
$ $
$-
%0
$$$%
4
#
= 9
$ $
%- % ! '9
!%
%!
69
"
#
%!
"
"
11
$'
) )
#
#
B #
%?
%
<
&%
$
!!
N %! !%&%
66
<
66
9
=
!!
!
66 N
$ $
!% %
"
#
#
$
$
$
$
"
"
$'
2
y k +1 = 0.21 x k
Comece com xo=yo=0.0.
Deve representar os pontos em separado no grfico da figura
usando as seguintes instrues:
2
$
$
66 $$$
$
, 2
3
0 ,
# 2
3
/ - K9) $; )K $; )
, 2
3
0 ,
# 2
3
/ - K9) $; )K $; )
$
#
$
-9)#9
$ D
- )#
9
;
!!
-9 # ' 9!8 3$
$\'#9
$ 9K$ D
-9)#9
- -9
# #9
"
$
$
$DZ+ H D+ 1H
$DZ+ H D+ 1H
K 9$ '8
3$ :
3$
"
[)[
"
12
$'
2
, 2
3
/)9 ) )9
#
$
#9
< $X
$ D
$ )#
9
9
!!
#9
'# ' 9K#
$ D
)#9
# #9
"
$
"
"
13
$'
3
, 2
-)#) )
$9
9
;
' $9
'
'8 3$
'8 3$
$ D
-)#
!!
"
"
"
14
import essential.*;
import java.awt.*;
public class halley{
public static void main(String[ ] args){
Graph one = new Graph();
one.setAxes(-5,40,-10,10);
one.setPointShape(new CirclePoint(PointShape.UNFILLED));
one.setDrawingStyle(Graphable.PLOTPOINTS);
double x,y,r,alfa,theta;
double a = 17.9;
double e = 0.967276;
10
1 3 6 10 15 21 28 36 45 55 66 ...
1 3 6 10 15 21 28 36 45 55 66 ...
15
1=1
1+1=2
1+2=3
2+3=5
3+5=8
5+8=13
8+13=21
13+21=34
16
17