Module 2 Practice- Cookie Calories.docx - Justin Falconer COP1000 June 7 2020 Module 2 Practice Cookie Calories Calories per cookie program Purpose

# Module 2 Practice- Cookie Calories.docx - Justin Falconer...

• 2
• 100% (1) 1 out of 1 people found this document helpful

This preview shows page 1 - 2 out of 2 pages.

Justin Falconer COP1000 June 7, 2020 Module 2 Practice: Cookie Calories Calories per cookie program Purpose Calculate number of calories per cookie consumed Flowchart
Justin Falconer COP1000 June 7, 2020 Module 2 Practice: Cookie Calories Pseudocode Function Main Declare Real calories, cookies Output "Enter number of cookies eaten" Input cookies Assign calories = cookies*75 Output "The calories consumed "&calories&"." End Source Code import java.util.*; import java.lang.Math; public class sampleProject { private static Scanner input = new Scanner(System.in); public static void main(String[] args) { double calories, cookies; System.out.println("Enter number of cookies eaten"); cookies = input.nextDouble(); calories = cookies * 75; System.out.println("The calories consumed " + calories + "."); } } Sample Execution run: Enter number of cookies eaten 10 The calories consumed 750.0. BUILD SUCCESSFUL (total time: 4 seconds)