Advertisement
Guest User

Untitled

a guest
Oct 26th, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. import java.io.*;
  2.  
  3. public class Rolling
  4. {
  5. public static void main (String[] args) throws IOException
  6. {
  7. int randomNum;
  8.  
  9. PrintWriter fileout = new PrintWriter (new FileWriter ("randumnums.txt"));
  10.  
  11. for (int i= 0; i < 101; i++)
  12. {
  13. randomNum = (int) (Math.random() * 100);
  14.  
  15. fileout.println (randomNum);
  16. }
  17. fileout.close();
  18. }
  19. }
  20.  
  21. import java.io.*;
  22.  
  23. public class Reading
  24. {
  25. public static void main (String[] args) throws IOException
  26. {
  27. BufferedReader readFile = new BufferedReader (new FileReader ("randumnums.txt"));
  28. int number = 0;
  29. int inMarks [] = new int [100];
  30.  
  31. for (int i = 0; i < 100; i++)
  32. {
  33. inMarks [i] = Integer.parseInt(readFile.readLine());
  34. }
  35. }
  36. }
  37.  
  38. int inMarks [] = new int [100];
  39.  
  40. for (int i = 0; i < 100; i++)
  41. {
  42. inMarks [i] = 0;
  43. }
  44.  
  45. String nextLine = null;
  46. while ((nextLine = readFile.readLine()) != null)
  47. {
  48. int thisInt = Integer.parseInt(nextLine);
  49. inMarks[thisInt] = inMarks[thisInt] + 1;
  50. }
  51.  
  52. import java.io.*;
  53.  
  54. public class Reading {
  55.  
  56. public static void main (String[] args) throws IOException {
  57. BufferedReader readFile = new BufferedReader (new FileReader("randumnums.txt"));
  58. int number = 0;
  59. int inMarks [] = new int [100];
  60. String readNumber = "";
  61.  
  62. while ((readNumber = readFile.readline()) != null) {
  63. number = Integer.parseInt(readNumber);
  64. inMarks[number]++;
  65. }
  66.  
  67. }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement