Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.30 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.util.Random;
  3.  
  4. public class juice {
  5.     public static void main(String args[]){
  6.         Scanner scan = new Scanner(System.in);
  7.         Random rand = new Random();
  8.         int juice = 99, weight, limit = 0;
  9.        
  10.         System.out.println("There are 99 bottles of apple juice on the wall ");
  11.         System.out.println("Please enter your weight to begin the party: ");
  12.         weight = scan.nextInt();
  13.        
  14.         if (weight <= 150){
  15.             limit = rand.nextInt(99)+70;
  16.         }
  17.         if (weight > 150 && weight <= 200){
  18.             limit = rand.nextInt(99)+50;
  19.         }
  20.         if (weight > 200){
  21.             limit = rand.nextInt(99)+1;
  22.         }
  23.        
  24.         while (juice > 2){
  25.             System.out.print(juice + " bottles of juice on the wall! ");
  26.             System.out.println(juice + " bottles of juice! \n You take one down - pass it around...");
  27.             juice -= 1;
  28.             System.out.println(juice + " bottles of juice on the wall!");
  29.             if (juice == limit){
  30.                 System.out.println("You've reached your limit and passed out");
  31.                 System.out.println("While passed out, a mugger stole your wallet");
  32.                 System.out.println("You should rethink your drinking habbits");
  33.             }      
  34.         }  
  35.         if (juice == 2){
  36.             System.out.println("Only 1 bottle of juice left on the wall!");
  37.             System.out.println("You take it down...pass it around \nNo more bottles of juice on the wall!");   
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement