-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPrenda.java
27 lines (21 loc) · 883 Bytes
/
Prenda.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
package com.mycompany.app;
public class Prenda {
TipoPrenda tipo;
Color colorPrimario;
Color colorSecundario = new SinColor();
public Prenda(TipoPrenda _tipo, Color _colorPrimario, Material _material) {
construir(_tipo, _colorPrimario, new SinColor(), _material);
}
public Prenda(TipoPrenda _tipo, Color _colorPrimario, Color _colorSecundario, Material _material) {
construir(_tipo, _colorPrimario, _colorSecundario, _material);
}
private void construir(TipoPrenda _tipo,Color _colorPrimario,Color _colorSecundario,Material _material){
try {
if(!_colorPrimario.tieneColor()) throw new Exception("Una prenda debe tener color primario");
} catch (Exception e) {
}
colorPrimario=_colorPrimario;
colorSecundario=_colorSecundario;
tipo=_tipo;
}
}