class HelloWorld {
public static void main
(String[] args
) { Aluno aluno = new Aluno("joao", 1, 8f, 6f);
aluno.exibir();
}
}
class Aluno {
private int matricula;
private float n1, n2;
public Aluno
(String nome,
int matricula,
float n1,
float n2
) { this.nome = nome;
this.matricula = matricula;
this.n1 = n1;
this.n2 = n2;
}
public float media() {
return (n1 + n2) / 2;
}
public void exibir() {
System.
out.
println("Nome:" +nome
); System.
out.
println("Matrícula:" + matricula
); System.
out.
println("Nota 1:" + n1
); System.
out.
println("Nota 2:" + n2
); System.
out.
println("A média é:" + media
()); }
}
//https://pt.stackoverflow.com/q/204494/101
Y2xhc3MgSGVsbG9Xb3JsZCB7CglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoU3RyaW5nW10gYXJncykgewoJCUFsdW5vIGFsdW5vID0gbmV3IEFsdW5vKCJqb2FvIiwgMSwgOGYsIDZmKTsKCQlhbHVuby5leGliaXIoKTsKCX0KfQoKY2xhc3MgQWx1bm8gewogICAgcHJpdmF0ZSBTdHJpbmcgbm9tZTsKICAgIHByaXZhdGUgaW50IG1hdHJpY3VsYTsKICAgIHByaXZhdGUgZmxvYXQgbjEsIG4yOwoKCXB1YmxpYyBBbHVubyhTdHJpbmcgbm9tZSwgaW50IG1hdHJpY3VsYSwgZmxvYXQgbjEsIGZsb2F0IG4yKSB7CgkgICAgdGhpcy5ub21lID0gbm9tZTsKCSAgICB0aGlzLm1hdHJpY3VsYSA9IG1hdHJpY3VsYTsKCSAgICB0aGlzLm4xID0gbjE7CgkgICAgdGhpcy5uMiA9IG4yOwoJfQoJCglwdWJsaWMgZmxvYXQgbWVkaWEoKSB7CgkgICAgcmV0dXJuIChuMSArIG4yKSAvIDI7Cgl9CgkKCXB1YmxpYyB2b2lkIGV4aWJpcigpIHsKCSAgICBTeXN0ZW0ub3V0LnByaW50bG4oIk5vbWU6IiArbm9tZSk7CgkgICAgU3lzdGVtLm91dC5wcmludGxuKCJNYXRyw61jdWxhOiIgKyBtYXRyaWN1bGEpOwoJICAgIFN5c3RlbS5vdXQucHJpbnRsbigiTm90YSAxOiIgKyBuMSk7CgkgICAgU3lzdGVtLm91dC5wcmludGxuKCJOb3RhIDI6IiArIG4yKTsKCSAgICBTeXN0ZW0ub3V0LnByaW50bG4oIkEgbcOpZGlhIMOpOiIgKyBtZWRpYSgpKTsKCX0KfQoKLy9odHRwczovL3B0LnN0YWNrb3ZlcmZsb3cuY29tL3EvMjA0NDk0LzEwMQ==