Skip to content

Instantly share code, notes, and snippets.

@lrlucena
Created May 3, 2016 19:04
Show Gist options
  • Save lrlucena/baeda4d4c322c5aeebaed95b8a59582c to your computer and use it in GitHub Desktop.
Save lrlucena/baeda4d4c322c5aeebaed95b8a59582c to your computer and use it in GitHub Desktop.
/*
Crie um programa para construir uma página HTML usando a função:
def pagina(font: String, cor: String)(titulo: String,
pessoas: List[Pessoa], mensagem: String): String
Uma pessoa pode ser um Aluno (nome, matricula, curso, periodo)
ou
Professor (nome, matricula, disciplina, diretoria).
*/
trait Pessoa {
val nome: String
val matricula: String
}
case class Aluno(nome: String, matricula: String, curso: String, periodo: String) extends Pessoa
case class Professor(nome: String, matricula: String, disciplina: String, diretoria: String) extends Pessoa
object Pagina extends App {
val aluno1 = Aluno("joao", "12345", "TADS", "4")
val prof1 = Professor("Antonio", "007", "programação", "DIATINF")
def pagina(font: String, cor: String)(titulo: String,
pessoas: List[Pessoa], mensagem: String): String =
s"""<html><head>
<title>${titulo}</title>
<style></style>
</head>
</html>"""
val pessoas = List(aluno1, prof1)
val p = pagina("Arial", "lightgreen") _
println(p("Pessoas", pessoas, "Isto é um teste"))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment