Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

public class MicrowaveCooking { public static void main(String[] args) { // Generate a random number of seconds // between 0 and 60 // Print the

public class MicrowaveCooking

{

public static void main(String[] args)

{

// Generate a random number of seconds

// between 0 and 60

// Print the number of seconds

// Use two if statements to print

// whether the roll is fine or will catch fire

}

}

image text in transcribed
Write a program that helps a novice microwave chef decide how long to microwave a refrigerated bread roll. Use the Math class to generate a random integer between 0 and 60 to represent the number of seconds the roll will be microwaved. Print out the number of seconds generated. If the number is less than or equal to 20, print Perfect cooking time! If the number is greater than 20, print Your roll will catch Fire! If you've forgotten how to use random numbers, refer back to this example: Random Number Example Here are a few output examples Example 1: Microwaving for 21 seconds Your roll will catch fire! Example 2: Microwaving for 9 seconds Perfect cooking time

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions