DodecahedronList.java - Project [email protected] Robert Marcum 1213...

This preview shows page 1 - 2 out of 2 pages.

/** * Project 5. * @author Robert Marcum - 1213 - Summer 2018 * @version 6/24/18 */ import java.util.ArrayList; import java.text.DecimalFormat; /** setting up the class dodecahedronlist. * for project 5. */ public class DodecahedronList { private String listName; private ArrayList<Dodecahedron> dodObjList; /** @param listNameIn input for the listName @param dodObjListIn input for the dodObjList */ public DodecahedronList(String listNameIn, ArrayList<Dodecahedron> dodObjListIn) { listName = listNameIn; dodObjList = dodObjListIn; } /** @return returns the name of the list */ public String getName() { return listName; } /** @return retuns the total number of objs in the array */ public int numberOfDodecahedrons() { return dodObjList.size(); } /** @return returns the total surface area */ public double totalSurfaceArea() { double total = 0; int index = 0; while (index < dodObjList.size()) { total += dodObjList.get(index).surfaceArea(); index++; } return total; } /** @return returns the total volume */ public double totalVolume() { double total = 0; int index = 0; while (index < dodObjList.size()) { total += dodObjList.get(index).volume(); index++; } return total; } /** @return returns the average surface area */ public double averageSurfaceArea() {

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture