/* The rental class represents a customer renting a movie. */ class Rental { private Movie movie; private int daysRented; public Rental(Movie movie, int daysRented) { this.movie = movie; this.daysRented = daysRented; } public int getDaysRented() { return daysRented; } public Movie getMovie() { return movie; } public double amountFor() { //determine amounts for each line double thisAmount = 0; int code = getMovie().getPriceCode(); if (code == Movie.REGULAR) { thisAmount += 2; if (getDaysRented() > 2) thisAmount += (getDaysRented() - 2) * 1.5; } else if (code == Movie.NEW_RELEASE) { thisAmount += getDaysRented() * 3; } else if (code == Movie.CHILDRENS) { thisAmount += 1.5; if (getDaysRented() > 3) thisAmount += (getDaysRented() - 3) * 1.5; } return thisAmount; } }