Advertisement
Guest User

Random

a guest
Oct 23rd, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. import java.util.Random;
  2. import java.util.Scanner;
  3.  
  4.  
  5. public class Main {
  6.  
  7. static Random rand = new Random();
  8. static Scanner in = new Scanner(System.in);
  9.  
  10. public static void main(String[] args) {
  11.  
  12. tar1();
  13. }
  14.  
  15. private static void tar2() {
  16. int iGrade;
  17.  
  18. iGrade = rand.nextInt(101);
  19.  
  20. if (iGrade < 55)
  21. {
  22. System.err.println("You failed the course!");
  23. }
  24. else if ()
  25. {
  26.  
  27. }
  28. }
  29.  
  30. private static void tar1() {
  31. int iNum1,iNum2,iNum3;
  32.  
  33. iNum1 = rand.nextInt(5)+3;
  34. iNum2 = rand.nextInt(5)+3;
  35. iNum3 = rand.nextInt(5)+3;
  36.  
  37. System.out.println("The first random number is: " + iNum1 + "\nThe second random number is: " + iNum2 + "\nThe third random number is: " + iNum3);
  38. System.out.println("The sum of all three numbers is: " + (iNum1+iNum2+iNum3));
  39. System.out.println("The multiplication of all three numbers is: " + (iNum1*iNum2*iNum3));
  40. }
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement