-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBalancoTrimestral.java
More file actions
33 lines (31 loc) · 1.14 KB
/
BalancoTrimestral.java
File metadata and controls
33 lines (31 loc) · 1.14 KB
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
import java.util.Scanner;
public class BalancoTrimestral{
public static Scanner leia=new Scanner(System.in);
private int gastoJaneiro;
private int gastoFevereiro;
private int gastoMarco;
private int total;
private int media;
public static void main(String args[]){
BalancoTrimestral balanco = new BalancoTrimestral();
balanco.setTotalMedia(15000, 23000, 17000);
balanco.saidaGastos();
}
public void setTotalMedia(int gastoJaneiro, int gastoFevereiro, int gastoMarco){
this.gastoJaneiro = gastoJaneiro;
this.gastoFevereiro = gastoFevereiro;
this.gastoMarco = gastoMarco;
this.total = (this.gastoJaneiro+this.gastoFevereiro+this.gastoMarco);
this.media = ((this.gastoJaneiro+this.gastoFevereiro+this.gastoMarco)/3);
}
public int getTotal(){
return total;
}
public int getMedia(){
return media;
}
public void saidaGastos(){
System.out.println("O valor total do gasto trimestral e: R$ "+getTotal());
System.out.println("A media gasta mensalmente e: R$"+getMedia());
}
}