daily pastebin goal
16%
SHARE
TWEET

Untitled

a guest Jun 19th, 2017 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Zach Enz
  2. //Home Assignment 3  [3.5]
  3. import java.util.Scanner;
  4. import java.util.Random;
  5.  
  6. class Home {
  7.  
  8.     public static void main(String[] args) {
  9.         //Declare Variables
  10.         int random, i;
  11.         i = 1;
  12.         int total = 0;
  13.  
  14.         Scanner scan = new Scanner(System.in);
  15.         Random generator = new Random();
  16.  
  17.         while (i0. < 4)
  18.         {
  19.             random = generator.nextInt(9);
  20.             System.out.println("Number" + i + ": " + random);
  21.  
  22.             i += 1;
  23.             total = total + random;
  24.         }
  25.  
  26.         System.out.println("Enter total");
  27.  
  28.         if (scan.nextInt() == total) {
  29.             System.out.println("Correct");
  30.         } else {
  31.             System.out.println("Wrong");
  32.         }
  33.  
  34.         System.exit(0);
  35.  
  36.     }
  37. }
RAW Paste Data
Top