Skip to content

Commit 6b92f11

Browse files
committed
codespaces
1 parent d65004a commit 6b92f11

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

IteracaoFor/App.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
public class App {
44
public static void main(String[] args) {
55
ExemploFor obj1 = new ExemploFor();
6-
obj1.exercicio5();
6+
obj1.exercicio6();
77
}
88
}

IteracaoFor/ExemploFor.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import java.util.Scanner;
44

5+
import javax.print.attribute.standard.Media;
6+
57
public class ExemploFor {
68
Scanner sc = new Scanner(System.in);
79

@@ -133,5 +135,29 @@ public void exercicio5() { // 20 n°s e determinar os pares e ímpares em outros
133135
System.out.println("vetor["+i+"]=" + nImpar[i]);
134136
}
135137
}
138+
139+
public void exercicio6() {
140+
double notas[] = new double[4];
141+
double medias[]= new double[10];
142+
double media;
143+
144+
for (int i = 0; i < notas.length; i++) {
145+
System.out.println("Nota["+i+"]=");
146+
notas[i] = sc.nextDouble();
147+
}
148+
for (int i = 0; i < medias.length; i++) {
149+
System.out.println("Média=" + notas[i]);
150+
medias[i] = sc.nextDouble();
151+
media = (notas[0] + notas[1] + notas[2] + notas[3]) / 4;
152+
if( media>=7) {
153+
System.out.println("O aluno passou");
154+
}
155+
else{
156+
System.out.println("O aluno não passou");
157+
}
158+
System.out.println("Sua média é " + media);
159+
}
160+
}
161+
136162
}
137163

IteracaoWhile/App.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
public class App {
44
public static void main(String[] args) {
55
ExerciciosWhile obj1 = new ExerciciosWhile();
6-
obj1.exercicio6();
6+
obj1.exercicio1();
77
}
88
}

0 commit comments

Comments
 (0)