-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInfosVenda.java
132 lines (122 loc) · 2.56 KB
/
InfosVenda.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
import java.util.Arrays;
import java.io.Serializable;
public class InfosVenda implements Serializable{
/**
* Quantidade vendida
*/
private int quantidade;
/**
* Preço do produto vendido
*/
private double preco;
/**
* Mes em que se realizou a venda
*/
private int mes;
/**
* Construtor vazio
*/
public InfosVenda(){
quantidade=0;
preco=0;
mes=0;
}
/**
* Construtor parametrizado
* @param preco
* @param quantidade
*/
public InfosVenda(double preco, int quantidade){
this.quantidade=quantidade;
this.preco=preco;
}
/**
* Construtor por cópia
* @param iv
*/
public InfosVenda(InfosVenda iv){
quantidade=iv.getQuantidade();
preco=iv.getPreco();
mes=iv.getMes();
}
/**
* Obter quantidade
* @return
*/
public int getQuantidade(){
return quantidade;
}
/**
* Obter preço
* @return
*/
public double getPreco(){
return preco;
}
/**
* Obter mes
* @return
*/
public int getMes(){
return mes;
}
/**
* Alterar quantidade
* @param qt
*/
public void setQuantidade(int qt){
quantidade=qt;
}
/**
* Alterar preço
* @param pr
*/
public void setPreco(double pr){
preco=pr;
}
/**
* Alterar mes
* @param mes
*/
public void setMes(int mes){
this.mes=mes;
}
/**
* toString
*/
public String toString(){
StringBuilder sb = new StringBuilder();
sb.append("Mes: ").append(this.mes).append("; ");
sb.append("Preco: ").append(this.preco).append("; ");
sb.append("Quant: ").append(this.quantidade).append("; ");
return sb.toString();
}
/**
* Equals
* @param o
* @return
*/
public boolean equals(Object o){
if(this==o) return true;
if(o==null || this.getClass()!=o.getClass()) return false;
InfosVenda v=(InfosVenda) o;
if(this.mes!=v.getMes()) return false;
if(this.quantidade!=v.getQuantidade()) return false;
if(this.preco!=v.getPreco()) return false;
return true;
}
/**
* Método clone
* @return
*/
public InfosVenda clone(){
return new InfosVenda(this);
}
/**
* hashCode
* @return
*/
public int hashCode(){
return Arrays.hashCode(new Object[]{quantidade,preco,mes});
}
}