Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner keyboard = new Scanner(System.in);
- float sugar = 1.5f;
- float butter = 1;
- float flour = 2.75f;
- float sugarNeeded;
- float butterNeeded;
- float flourNeeded;
- float cookies;
- System.out.println("How many cookies you want to make?");
- cookies = keyboard.nextFloat();
- sugarNeeded = sugar / (48 / cookies);
- butterNeeded = butter / (48 / cookies);
- flourNeeded = flour / (48 / cookies);
- System.out.println("You need:" + "\n" + sugarNeeded + " cups of sugar" + "\n" + butterNeeded + " cup of butter" + "\n" + flourNeeded + " cups of flour");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment