Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Estudo_Estilo_PBL/Estudo_Estilo_PBL.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
Binary file not shown.
Binary file not shown.
Binary file not shown.
24 changes: 24 additions & 0 deletions Estudo_Estilo_PBL/src/Conta.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
public class Conta {
private int numero;
private double saldo;

public Conta(int numero) {
this.numero = numero;
this.saldo = 0.0;
}
public void deposito (double valor) {
this.saldo += valor;
}

public void sacar (double valor) {
this.saldo -= valor;
}

public double getSaldo() {
return this.saldo;
}

public int getNumero() {
return this.numero;
}
}
44 changes: 44 additions & 0 deletions Estudo_Estilo_PBL/src/ContaInterface.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import java.util.Scanner;
public class ContaInterface {

private int opc;
private Scanner input = new Scanner(System.in);

public ContaInterface() {

}

public void menu(Conta conta){
do {
System.out.printf("1 -> Depositar valor\n2 -> Sacar valor\n3 -> Conferir saldo\n4 -> Sair\nOpção: ");
this.opc = input.nextInt();

switch (this.opc) {
case 1:
System.out.printf("Informe o valor que deseja depositar: ");
double valor = input.nextDouble();
System.out.println();
System.out.println();
conta.deposito(valor);
break;
case 2:
System.out.printf("Informe o valor que deseja sacar: ");
valor = input.nextDouble();
System.out.println();
System.out.println();
conta.sacar(valor);
break;
case 3:
double saldo = conta.getSaldo();
System.out.printf("O seu saldo é: %.2f\n", saldo);
break;
case 4: System.out.println("Obrigado pela utilização");
break;

default: System.out.println("Opção não disponivel");

}
} while(this.opc != 4);
}

}
8 changes: 8 additions & 0 deletions Estudo_Estilo_PBL/src/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
public class Main {
public static void main(String[] args) {
Conta conta = new Conta(123456789);
ContaInterface contaInterface = new ContaInterface();

contaInterface.menu(conta);
}
}