Untitled

Run Settings
LanguageJava
Language Version
Run Command
import java.util.Random; //required to generate random numbers class Main { public static void main(String[] args) { Random r = new Random(); //instance of random class double price=39.00; //begin with price of $39.00 System.out.println("Starting price: $"+price); //print starting value //use a loop to continuously subtract random values until it reaches zero. while(price>24.99){ //intitate loop double randomPrice=r.nextDouble(); //create random double as double price -= randomPrice; //subtract random value from current price System.out.println("Current Price: $"+price); //indicate new price to user if (price == 24.99); System.out.println ("Current Price: $"+price + (" buy now ")); } //end loop } }
Editor Settings
Theme
Key bindings
Full width
Lines