Question
1. Creating a BlueJ Project Create a BlueJ project and create a Class called RecipeProgram. If you need help with using BlueJ refer to the
1. Creating a BlueJ Project Create a BlueJ project and create a Class called RecipeProgram.
If you need help with using BlueJ refer to the Unit 5: IDEs lecture
Open the editor, and replace the automatically generated source code with the following:
import java.util.Scanner; public class RecipeProgram { static Scanner in = new Scanner(System.in); // Program function public static void main(String args[]) { System.out.println( "COOKIE RECIPE PROGRAM" ); } }
2. Declaring variables Declare the following variables as Doubles: batches tspBakingSoda tspBakingPowder cupsButter cupsSugar amountEggs
Compile your program before continuing! Fix any errors that pop up!
3. Input and output Next, display a message to the user using System.out.println( "..." );, replacing ... with the message: Ask the user How many batches of cookies to make?
Next, you will use the Scanner object to get input from the user and store it in the batches variable, like this: batches = in.nextDouble();
Compile your program and run it before continuing to verify that it works correctly!
4. Math operations Then you will assign values to each of the ingredient variables, multiplied by the number of batches. Assign the following values to each: tspBakingSoda is 1.0 * batches tspBakingPowder is 0.5 * batches cupsButter is 1.0 * batches cupsSugar is 1.5 * batches amountEggs is 1.0 * batches
Display each of the variables to the screen, WITH labels for what they represent.
(
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started