forked from loiane/curso-java-basico
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added exercicios aula 19 - vetores - netbeans
- Loading branch information
Showing
12 changed files
with
315 additions
and
42 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
netbeans/curso-java-basico/src/com/loiane/cursojava/aula19/labs/Exer19.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package com.loiane.cursojava.aula19.labs; | ||
|
||
import java.util.Scanner; | ||
|
||
/** | ||
* | ||
* @author loiane | ||
*/ | ||
public class Exer19 { | ||
|
||
public static void main(String[] args){ | ||
|
||
Scanner scan = new Scanner(System.in); | ||
|
||
double[] notas1 = new double[10]; | ||
double[] notas2 = new double[notas1.length]; | ||
double[] resultados = new double[notas1.length]; | ||
|
||
for (int i=0; i<notas1.length; i++){ | ||
|
||
System.out.println("Entre com a nota 1 do aluno " + (i+1)); | ||
notas1[i] = scan.nextDouble(); | ||
|
||
System.out.println("Entre com a nota 2 do aluno " + (i+1)); | ||
notas2[i] = scan.nextDouble(); | ||
|
||
resultados[i] = (notas1[i] + notas2[i]) / 2; | ||
} | ||
|
||
System.out.print("Notas 1 = "); | ||
for (int i=0; i<notas1.length; i++){ | ||
System.out.print(notas1[i] + " "); | ||
} | ||
System.out.println(); | ||
|
||
System.out.print("Notas 2 = "); | ||
for (int i=0; i<notas2.length; i++){ | ||
System.out.print(notas2[i] + " "); | ||
} | ||
System.out.println(); | ||
|
||
System.out.println("Resultados:"); | ||
for (int i=0; i<resultados.length; i++){ | ||
|
||
if (resultados[i] >= 7){ | ||
System.out.println(resultados[i] + " - Aprovado"); | ||
} else { | ||
System.out.println(resultados[i] + " - Reprovado"); | ||
} | ||
} | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
netbeans/curso-java-basico/src/com/loiane/cursojava/aula19/labs/Exer24.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package com.loiane.cursojava.aula19.labs; | ||
|
||
import java.util.Scanner; | ||
|
||
/** | ||
* | ||
* @author loiane | ||
*/ | ||
public class Exer24 { | ||
|
||
public static void main(String[] args){ | ||
|
||
Scanner scan = new Scanner(System.in); | ||
|
||
int[] vetorA = new int[10]; | ||
|
||
for (int i=0; i<vetorA.length; i++){ | ||
|
||
System.out.println("Entre com um número para a posição " + i); | ||
vetorA[i] = scan.nextInt(); | ||
|
||
} | ||
|
||
|
||
//1221 | ||
//i = 2 | ||
|
||
boolean palindromo = true; | ||
for (int i=0; i<(vetorA.length/2); i++){ | ||
|
||
if (vetorA[i] != vetorA[vetorA.length - 1 - i]){ | ||
palindromo = false; | ||
break; | ||
} | ||
} | ||
|
||
System.out.print("Vetor A = "); | ||
for (int i=0; i<vetorA.length; i++){ | ||
System.out.print(vetorA[i] + " "); | ||
} | ||
System.out.println(); | ||
|
||
if (palindromo){ | ||
System.out.println("Palindromo"); | ||
} else { | ||
System.out.println("Não é palindromo"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 0 additions & 21 deletions
21
netbeans/curso-java-basico/src/com/loiane/cursojava/aula19/labs/Exer31.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.