package com.company;
import com.sun.xml.internal.ws.api.model.wsdl.WSDLOutput;
import sun.security.acl.AclEntryImpl;
import java.awt.*;
public class Main<println> {
public static void main(String[] args) {
Client gustavo = new Client();
gustavo.setName("Gustavo Oliveira");
gustavo.setCpf("99999999999");
gustavo.setOccupation("software engineering");
Account gustavoAccount = new Account();
gustavoAccount.deposit(1000);
gustavoAccount.setHolder(gustavo);
System.out.println(gustavoAccount.getHolder());
System.out.println(gustavoAccount.toString());
Account camilaAccount = new Account();
Client camila = new Client();
camila.setName("Camila Nunes");
camilaAccount.setHolder(camila);
System.out.println(camila);
System.out.println(camilaAccount.getHolder());
System.out.println(camilaAccount.toString());
}
}
package com.company;
public class Client {
private String name;
private String cpf;
private String occupation;
public Client() {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCpf() {
return cpf;
}
public void setCpf(String cpf) {
this.cpf = cpf;
}
public String getOccupation() {
return occupation;
}
public void setOccupation(String occupation) {
this.occupation = occupation;
}
}
package com.company;
public class Account {
private double balance;
private int agency;
private int accountNumber;
private Client holder;
public Account() {
this.balance = balance;
this.agency = agency;
this.accountNumber = accountNumber;
this.holder = holder;
}
@Override
public String toString() {
return "Account{" +
"balance=" + balance +
", agency=" + agency +
", accountNumber=" + accountNumber +
", holder=" + holder +
'}';
}
public void deposit(double value){
if (value > 0){
this.balance += value;
}
}
public void withdraw(double value){
if (this.balance >= value){
this.balance -= value;
}
}
public boolean transfer(double value, Account destinyAccount){
if (this.balance >= value){
this.withdraw(value);
destinyAccount.deposit(value);
return true;
}
return false;
}
public double getBalance() {
return balance;
}
public int getAgency() {
return agency;
}
public int getAccountNumber() {
return accountNumber;
}
public Client getHolder() {
return holder;
}
public void setHolder(Client holder){
this.holder =holder;
}
}