Back to project page CoffeePicker.
The source code is released under:
GNU General Public License
If you think the Android project CoffeePicker listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package app.domain.coffeepicker; // ww w . j a v a 2 s . c o m import java.util.ArrayList; import java.util.Random; /** * Class that will actually generate the coffee choice * Created by sean on 1/11/15. */ public class CoffeeSpinner { private ArrayList<String> coffeeTypes; private ArrayList<String> sweeteners; private ArrayList<String> flavorings; private ArrayList<String> temperatues; /** * Constructor */ public CoffeeSpinner() { coffeeTypes = new ArrayList<String>(); sweeteners = new ArrayList<String>(); flavorings = new ArrayList<String>(); temperatues = new ArrayList<String>(); //set coffeeTypes object to defaults coffeeTypes.add("drip"); coffeeTypes.add("latte"); coffeeTypes.add("cappuccino"); coffeeTypes.add("espresso"); coffeeTypes.add("pour-over"); coffeeTypes.add("french press"); //set sweeteners sweeteners.add("nothing"); sweeteners.add("cream"); sweeteners.add("milk"); sweeteners.add("sugar (or substitute)"); sweeteners.add("cream and sugar"); sweeteners.add("milk and sugar"); //flavorings flavorings.add("vanilla"); flavorings.add("hazelnut"); flavorings.add("caramel"); flavorings.add("mocha"); flavorings.add("blueberry"); //temps temperatues.add("hot"); temperatues.add("iced"); } /** * Generates the coffee choice * @return -> String representing what coffee choice was spun */ public ArrayList<String> getCoffeePick() { Random r = new Random(); ArrayList<String> result = new ArrayList<String>(); result.add(coffeeTypes.get(r.nextInt(coffeeTypes.size()))); result.add(sweeteners.get(r.nextInt(sweeteners.size()))); result.add(flavorings.get(r.nextInt(flavorings.size()))); result.add(temperatues.get(r.nextInt(temperatues.size()))); return result; } /** * reads the preference store to determine which coffee choices are valid and stores options * that are possible in ArrayList<String>() objects private to the class */ private void readPreferences () { } }