Ayuda con Problema con un "public" " [Error] expected unqualified-id before "public" "
Publicado por Jose (1 intervención) el 16/04/2021 00:07:50
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
#include <iostream>
using namespace std;
public abstract class Camiseta {
protected String nombre;
protected Integer talla;
protected String color;
protected String manga;
protected String estampado;
protected Object material;
public Camiseta (String nombre,Integer talla, String color, String manga, String estampado, Object material){
this.nombre = nombre;
this.talla = talla;
this.color = color;
this.manga = manga;
this.estampado = estampado;
this.material = material;
}
public abstract Camiseta clone();
}
class CamisetaMCorta {
public CamisetaMCorta(Integer talla, String color, String estampado){
this.nombre = "Prototipo";
this.talla = talla;
this.color = color;
this.manga = "Corta";
this.estampado = estampado;
this.material = new Lana();
}
public Camiseta clone(){
return new CamisetaMCorta(this.talla, this.color, this.estampado);
}
}
class CamisetaMLarga {
public CamisetaMLarga(Integer talla, String color, String estampado){
this.nombre = "Prototipo";
this.talla = talla;
this.color = color;
this.manga = "Larga";
this.estampado = estampado;
this.material = new Lana();
}
public Camiseta clone(){
return new CamisetaMLarga(this.talla, this.color, this.estampado);
}
}
public static void main(String[] args) {
Camiseta prototipoMCorta = new CamisetaMCorta(40, "blanco", "Logotipo");
Camiseta prototipoMLarga = new prototipoMLarga(40, "blanco", "Logotipo");
ArrayList camisetas = new ArrayList();
for(int i = 0; i<args.length;i++){
Camiseta cc = prototipoMCorta.clone();
cc.setEstampado(args[i]);
for(int j = 35; j<60; j++){
Camiseta cc_talla = cc.clone();
cc_talla.setTalla(j);
camisetas.add(cc_talla);
}
Camiseta cl = prototipoMLarga.clone();
cl.setEstampado(args[i]);
for(int j = 35; j<60; j++){
Camiseta cl_talla = cl.clone();
cl_talla.setTalla(j);
camisetas.add(cl_talla);
}
}
}
Valora esta pregunta


0