Methods Summary |
---|
void | total()
System.out.println(
"Total Aluminum: $" + alSum + "\n" +
"Total Paper: $" + pSum + "\n" +
"Total Glass: $" + gSum + "\n" +
"Total Cardboard: $" + cSum);
|
public void | visit(VAluminum al)
double v = al.weight() * al.value();
System.out.println(
"value of Aluminum= " + v);
alSum += v;
|
public void | visit(VPaper p)
double v = p.weight() * p.value();
System.out.println(
"value of Paper= " + v);
pSum += v;
|
public void | visit(VGlass g)
double v = g.weight() * g.value();
System.out.println(
"value of Glass= " + v);
gSum += v;
|
public void | visit(VCardboard c)
double v = c.weight() * c.value();
System.out.println(
"value of Cardboard = " + v);
cSum += v;
|