Movie - import java.util.Arrays; i import java.util.Date;...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.util.Arrays; import java.util.Date; i public class Movie extends Rental { private String title; private Customer[] historyCusts; private double[] historyLengths; private static final int maxHistory = 10; private int numHistory; private Customer currentCust; public Movie() { this(new String(), new Customer[0], new double[0]); } public Movie(String title) { this(title, new Customer[0], new double[0]); } public Movie(String title, Customer[] historyCusts, double[] historyLengths) { setTitle(title); setCurrentCust(null); setCheckOutDate(null); this.historyCusts = new Customer[maxHistory]; this.historyLengths = new double[maxHistory]; numHistory = Math.min(historyCusts.length, maxHistory); for( int i=0; i<numHistory; i++ ) { this.historyCusts[i] = historyCusts[i]; this.historyLengths[i] = historyLengths[i]; } } public double getLength(Customer myCust) { double totlen = 0.0; for( int i=0; i<numHistory; i++ ) if( historyCusts[i].getName().equals(myCust.getName()) ) totlen += historyLengths[i];
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

Movie - import java.util.Arrays; i import java.util.Date;...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online