ackage aula3static;
public class Conta {
static private int totalContas;
static private double valorContas;
private String nomeBanco;
private String nomeGerente;
public Conta(String nomeBanco, String nomeGerente, int totalContas,double valorContas) {
this.nomeBanco = nomeBanco;
this.nomeGerente = nomeGerente;
this.valorContas= valorContas;
this.totalContas= totalContas;
}
public Conta(){
}
public int getTotalContas() {
return totalContas++;
}
public void setTotalContas(int totalContas) {
this.totalContas = totalContas;
totalContas++;
}
public double getValorContas() {
return valorContas;
}
public void setValorContas(double valorContas) {
this.valorContas = valorContas;
valorContas++;
}
public String getNomeBanco() {
return nomeBanco;
}
public void setNomeBanco(String nomeBanco) {
this.nomeBanco = nomeBanco;
}
public String getNomeGerente() {
return nomeGerente;
}
public void setNomeGerente(String nomeGerente) {
this.nomeGerente = nomeGerente;
}
}
package aula3static;
public class Principal {
public static void main(String[] args) {
Conta conta1 = new Conta("Banco A","Jairo",2,3.50);
System.out.println(conta1.getNomeBanco()+" gerente:"+conta1.getNomeGerente()+" totalContas:"
+conta1.getTotalContas()+" valorContas:"+conta1.getValorContas());
System.out.println("");
Conta conta2 = new Conta();
conta2.setNomeBanco("Banco z");
conta2.setNomeGerente("Paulo");
conta2.setTotalContas(3);
conta2.setValorContas(5.50);
System.out.println(conta2.getNomeBanco()+" gerente:"+conta2.getNomeGerente()+" totalContas:"
+conta2.getTotalContas()+" valorContas:"+conta2.getValorContas());
}
}