File tree Expand file tree Collapse file tree 7 files changed +115
-6
lines changed
Expand file tree Collapse file tree 7 files changed +115
-6
lines changed Original file line number Diff line number Diff line change 33public class App {
44 public static void main (String [] args ) {
55 Exercicios obj1 = new Exercicios ();
6- obj1 .exercicio3 ();
6+ obj1 .exercicio6 ();
77 }
88}
Original file line number Diff line number Diff line change @@ -202,11 +202,11 @@ public void exercicio6() {
202202
203203 for (int i = 0 ; i < C .length ; i ++) {
204204 for (int j = 0 ; j < C [i ].length ; j ++) {
205- for (int j2 = 0 ; j2 < A [i ].length ; j2 ++) {
206- C [i ][j ] += A [i ][j2 ] * B [i ][ j2 ];
207- }
205+ for (int k = 0 ; k < A [i ].length ; k ++){
206+ C [i ][j ] += A [i ][k ] * B [k ][ j ];
207+ }
208208 }
209- }
209+ }
210210
211211 System .out .println ("Matriz C: " );
212212 for (int i = 0 ; i < C .length ; i ++) {
Original file line number Diff line number Diff line change 1+ package PooHeranca ;
2+
3+ public class Alunos extends Pessoas {
4+ //subclasse de pessoas
5+ // atributos específicos
6+
7+ private int nMatricula ;
8+ private String curso ;
9+ private double mediaSemestre ;
10+ private String turma ;
11+
12+ // métodos
13+ public int getnMatricula () {
14+ return nMatricula ;
15+ }
16+ public void setnMatricula (int nMatricula ) {
17+ this .nMatricula = nMatricula ;
18+ }
19+ public String getCurso () {
20+ return curso ;
21+ }
22+ public void setCurso (String curso ) {
23+ this .curso = curso ;
24+ }
25+ public double getMediaSemestre () {
26+ return mediaSemestre ;
27+ }
28+ public void setMediaSemestre (double mediaSemestre ) {
29+ this .mediaSemestre = mediaSemestre ;
30+ }
31+ public String getTurma () {
32+ return turma ;
33+ }
34+ public void setTurma (String turma ) {
35+ this .turma = turma ;
36+ }
37+
38+
39+ }
Original file line number Diff line number Diff line change 22
33public class App {
44 public static void main (String [] args ) {
5-
5+ Alunos aluno1 = new Alunos ();
66 }
77}
Original file line number Diff line number Diff line change 1+ package PooHeranca ;
2+
3+ public class Funcionarios extends Pessoas {
4+ //subclasse de pessoas
5+ // atributos específicos
6+ private int salario ;
7+ private String empresa ;
8+ }
Original file line number Diff line number Diff line change 1+ package PooHeranca ;
2+
3+ public class Pessoas {
4+ //super classe (fornecer herança para as outras classes
5+ // atributos genéricos (comuns a todas as classes herdeiras)
6+ // atributos
7+ String nome ;
8+ String endereco ;
9+ int idade ;
10+ String cpf ;
11+
12+ // métodos
13+ public String getNome () {
14+ return nome ;
15+ }
16+ public void setNome (String nome ) {
17+ this .nome = nome ;
18+ }
19+ public String getEndereco () {
20+ return endereco ;
21+ }
22+ public void setEndereco (String endereco ) {
23+ this .endereco = endereco ;
24+ }
25+ public int getIdade () {
26+ return idade ;
27+ }
28+ public void setIdade (int idade ) {
29+ this .idade = idade ;
30+ }
31+ public String getCpf () {
32+ return cpf ;
33+ }
34+ public void setCpf (String cpf ) {
35+ this .cpf = cpf ;
36+ }
37+
38+ }
Original file line number Diff line number Diff line change 1+ package PooHeranca ;
2+
3+ public class Professores extends Pessoas {
4+ //subclasse de pessoas
5+ // atributos específicos
6+ private String materia ;
7+ private int salario ;
8+
9+ // métodos
10+ public String getMateria () {
11+ return materia ;
12+ }
13+ public void setMateria (String materia ) {
14+ this .materia = materia ;
15+ }
16+ public int getSalario () {
17+ return salario ;
18+ }
19+ public void setSalario (int salario ) {
20+ this .salario = salario ;
21+ }
22+
23+
24+ }
You can’t perform that action at this time.
0 commit comments