buy now

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>=0.00){ //intitate loop if (price>=24.99){ 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 } else{ System.out.println("$"+price+" BUY NOW!!!"); break; } } //end loop } }
Editor Settings
Theme
Key bindings
Full width
Lines