Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CONCLUSÃO DA ATIVIDADE COM IMPLEMENTAÇÃO DE BOAS PRATICAS #59

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/aprenda-kotlin-com-exemplos-lab.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 0 additions & 21 deletions desafio.kt

This file was deleted.

1 change: 1 addition & 0 deletions src/main/Kotlin/ConteudoEucacional.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
data class ConteudoEducacional(var nome: String, var duracao: Int)
12 changes: 12 additions & 0 deletions src/main/Kotlin/Formacao.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
data class Formacao(
val nome: String,
var conteudos: List<ConteudoEducacional>,
val nivel: Nivel
) {

val inscritos = mutableListOf<Usuario>()
fun matricular(usuario: Usuario) {
inscritos.add(usuario);
println("O usuario ${usuario.nome} com ID ${usuario.id} foi matriculado")
}
}
54 changes: 54 additions & 0 deletions src/main/Kotlin/Main.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
fun main() {
val cursos = mutableListOf<Formacao>()
cursos.add(
Formacao(
nome = "Orientação a objetos em kotlin", conteudos = listOf(
ConteudoEducacional(
nome = "Classes e Propriedades", duracao = 30
)
), nivel = Nivel.BASICO
))


cursos.add(
Formacao(
nome = "Herança", conteudos = listOf(
ConteudoEducacional(
nome = "Poliformismo, encapsulamento e interface",
duracao = 10
)
), nivel = Nivel.INTERMEDIARIO
))

cursos.add(
Formacao(
nome = "Conceitos avançados", conteudos = listOf(
ConteudoEducacional(
nome = "Composição",
duracao = 10
)
), nivel = Nivel.DIFICIL
))

//Cadastro de um novo aluno que posssui um nome e um id;
val renan = Usuario(id = 1, nome = "Renan")
cursos[0].matricular(renan)

val eduardo = Usuario(id = 2, nome = "Eduardo")
cursos[0].matricular(eduardo)

val maria = Usuario(id = 3, nome = "Maria")
cursos[1].matricular(maria)


//impressão da lista de alunos e seus respectivos aspectos (nome e id)
cursos.forEach {
println("${it.nome}, ${it.nivel.toString()}")

println("Número de alunos matriculados: ${it.inscritos.size}")
println("Lista de alunos: \n")
it.inscritos.forEach { inscritos ->
println("${inscritos.nome}")
}
}
}
1 change: 1 addition & 0 deletions src/main/Kotlin/Nivel.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enum class Nivel { BASICO, INTERMEDIARIO, DIFICIL }