-
-
Save lithid/6384631 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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