package metab; import java.io.*; /** * The Drink class is a simple way to represent an alcoholic * beverage. Values used include the ethanol concentration (%), the volume (oz), * and the name of the beverage. The percent volume of ethanol can be determined * by using the total volume and the concentration. This class allows for infinite * numbers of different drinks. * @author Levi Blackstone, Matthew Woller * @version 1.03 */ public class Drink implements Serializable{ /** * Concentration of beverage (percent). */ private double concentration; /** * Volume of beverage (oz). */ private double volume; /** * Name of the beverage. */ private String name; /** * Constructor for Drink class. * @param concentration Concentration of beverage (percent). * @param volume Volume of beverage (oz). */ Drink(double concentration, double volume, String name) { this.concentration = concentration; this.volume = volume; this.name = name; } /** * Retrieves concentration of beverage. * @return double representing concentration of beverage (percent). */ public double getConcentration() { return concentration; } /** * Retrieves the name and description of the drink. * @return String containing the drink name. */ public String getName() { return this.name; } /** * Retrieves volume of beverage. * @return double representing volume of beverage (oz). */ public double getVolume() { return volume; } /** * Retrieves a copy of beverage concentration and volume (percent, L). * @return Drink representing new instance of current beverage. */ public Drink getCopy() { return new Drink(this.concentration, this.volume, this.name); } }