package FSC; import java.util.*; /** * FilmStockCalc is the class that defines a cataglog of film stock types and * provides calculations for the amount of film stock needed and the film cost * for a motion picture film project. * * @author Larry Aasen */ public class FilmStockCalc { /** * This is the default constructor. * @return nothing. */ public FilmStockCalc() { mFilmStockList.add( new FilmStock( "35 mm", 35, 90 ) ); mFilmStockList.add( new FilmStock( "16 mm", 16, 36 ) ); mFilmStockList.add( new FilmStock( "Super 16", 16, 36 ) ); mFilmStockList.add( new FilmStock( "Super 8", 8, 20 ) ); mFilmStockList.add( new FilmStock( "8 mm", 8, 18 ) ); mFilmStockList.add( new FilmStock( "70 mm", 70, 330 ) ); } public ArrayList getFilmStockList() { return mFilmStockList; } /** * This method will calculate the film cost for a motion picture film project. * * @param stock the Film Stock to be used. * @param ratio the shooting ratio of the film. If the ratio is 8:1 then * this parameter would be 8. * @param runningTime the length of the film in minutes. * camera in feet per minute. * @param price the price per foot of film stock in dollars. * @param discount the amount of the discount expected as a percentage. If the discount is 10% * this parameter would be 10.0. * @param tax the amount of tax expected to pay. If the tax rate is 8.25 % then * this parameter would be 8.25. * @return The total cost of the film stock. */ public double CalculateCost( FilmStock stock, int ratio, int runningTime, double price, double discount, double tax ) { double totalFeet = CalculateLength( stock, ratio, runningTime ); // Determine the cost double cost = price * totalFeet; // Factor in the discount if ( discount != 0.0f ) cost *= 1.0f - ( discount / 100.0f ); // Add the tax if ( tax != 0.0f ) cost *= ( tax / 100.0f ) + 1.0f; return cost; } /** * This method will calculate the amount of film stock required for a motion picture film project. * * @param stock the Film Stock to be used. * @param ratio the shooting ratio of the film. If the ratio is 8:1 then * this parameter would be 8. * @param runningTime the length of the film in minutes. * camera in feet per minute. * @return The total length of film stock in feet. */ public int CalculateLength( FilmStock stock, int ratio, int runningTime ) { // Determine the feet/min for the selected film type int ft_min = stock.getFrameSpeed(); // Determine the cost int totalFeet = ft_min * runningTime * ratio; return totalFeet; } private ArrayList mFilmStockList = new ArrayList(); }