Skip to content

Instantly share code, notes, and snippets.

@lithid
Created August 29, 2013 23:24
Show Gist options
  • Save lithid/6384631 to your computer and use it in GitHub Desktop.
Save lithid/6384631 to your computer and use it in GitHub Desktop.
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"
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment