Skip to content

Instantly share code, notes, and snippets.

@lithid
Created August 29, 2013 23:24
Show Gist options
  • Select an option

  • Save lithid/6384631 to your computer and use it in GitHub Desktop.

Select an option

Save lithid/6384631 to your computer and use it in GitHub Desktop.

Revisions

  1. lithid created this gist Aug 29, 2013.
    36 changes: 36 additions & 0 deletions meh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,36 @@
    import javax.swing.JOptionPane;

    public class Main {
    public static void main(String[] args){
    String s;
    s = JOptionPane.showInputDialog("Enter batch size: ");
    Recipe.request = Double.parseDouble(s);
    Recipe.factor = Recipe.request / Recipe.food;
    for (int i = (int) r.z; i < Recipe.sFoodList.length; i++){
    Recipe.sFoodList[i] = Recipe.factor * Recipe.sFoodList[i];
    System.out.println(Recipe.sFoodName[i] + ": " + Recipe.sFoodList[i] + " " + Recipe.sFoodType[i]);
    }
    }
    }

    public class Recipe {

    public double request, factor;

    public static final double food = 112;
    public static final double z = 0;

    public static final double[] sFoodList = {
    2, 4, 2, 2, 5, 24, 2, 1, 18, 4, 2, 2, 3
    };

    public static final String[] sFoodName = {
    "Butter", "Flour", "Baking Soda", "Sugar", "Oatmeal", "Chocolate Chips",
    "Brown Sugar", "Salt", "Hershey's Bar", "Eggs", "Baking Powder",
    "Vanilla", "Nuts"
    };
    public static final String[] sFoodType = {
    "cups", "cups", "tsp", "cups", "cups", "oz", "cups", "tsp", "oz", "",
    "tsp", "tsp", "cups"
    };
    }