Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.JOptionPane;
- public class CookieJOpt {
- public static void main (String[] args)
- {
- String input, galleta;
- double sugar = 1.5/48;// amount needed per cookie
- double butter = 1/48;
- double flour = 2.75/48;
- galleta =
- JOptionPane.showInputDialog(null,"How many cookies would you like to bake?");
- int cookie = Integer.parseInt(galleta);
- JOptionPane.showMessageDialog(null,String.format("You will need:\n" + "Sugar %s,.3f" +
- sugar*cookie + "\nButter %s,.3f" + butter*cookie + "\nFlour %s,.3f" + flour*cookie));
- System.exit(0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement