-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInvestimento.java
64 lines (49 loc) · 1.69 KB
/
Investimento.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package ruan;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Investimento extends Patrimonio{
private String tipoInvst;
private String instituicao;
private float valorInicial;
private float rentabilidade;
//Construtor Investimento
public Investimento(float valor, float numPatrimonio, Date dataAquisicao, String tipoInvst, String instituicao, float valorInicial, float rentabilidade){
super(valor, numPatrimonio, dataAquisicao);
this.tipoInvst = tipoInvst;
this.instituicao = instituicao;
this.valorInicial = valorInicial;
this.rentabilidade = rentabilidade;
}
//Gets Investimento
public String getTipoInvst(){
return tipoInvst;
}
public String getInstituicao(){
return instituicao;
}
public float getValorInicial(){
return valorInicial;
}
public float getRentabilidade(){
return rentabilidade;
}
//Sets Investimento
public void setTipoInvst(String tipoInvst){
this.tipoInvst = tipoInvst;
}
public void setInstituicao(String instituicao){
this.instituicao = instituicao;
}
public void setValorInicial(float valorInicial){
this.valorInicial = valorInicial;
}
public void setRentabilidade(float rentabilidade){
this.rentabilidade = rentabilidade;
}
//ToString Investimento
public String toString() {
SimpleDateFormat formato = new SimpleDateFormat("dd/MM/yy");
return "Valor: " + valor + ", Número de Patrimônio: " + numPatrimonio + "Data de aquisição: " + formato.format(dataAquisicao)
+ "Modalidade da aplicação: " + tipoInvst + " Instituição: " + instituicao + " Valor inicial investido: " + valorInicial + " Rentabilidade: " + rentabilidade;
}
}