/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package test1exp; /** * * @author jcmt */ public class SportsCars { private DreamCar[] myCars; public SportsCars() { myCars = new DreamCar[5]; for (int i=0;i<5;i++) { myCars[i] = new DreamCar(); } } public SportsCars(Colors co) { myCars = new DreamCar[5]; for (int i=0;i<5;i++) { myCars[i] = new DreamCar(co); } } // assume proper constructor, set and get methods are defined public void printModnValue() { for (DreamCar car : myCars) { System.out.println("Model is " + car.getModel() + " and value is " + car.getValue()); } } }