skilletwaffles

lab 28.2

Mar 13th, 2015
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. import chn.util.*;
  2. import java.util.*;
  3. /**
  4. * Write a description of class CountDriver here.
  5. *
  6. * @author (your name)
  7. * @version (a version number or a date)
  8. */
  9.  
  10. public class CountDriver
  11. {
  12.  
  13.  
  14. /**
  15. * Constructor for objects of class CountDriver
  16. */
  17. public CountDriver()
  18. {
  19.  
  20. }
  21.  
  22. /**
  23. * main() method to start running code
  24. *
  25. *
  26. */
  27. public static void main(String[] args)
  28. {
  29. int totalWords = 0;
  30. Word uniqueWord;
  31. String temp = "";
  32. FileInput inFile = new FileInput("dream.txt", " !~@#$%^&*()_+=|\\{}\"[]<>.,?/;:\t\n\r\f0123456789");
  33. ArrayList words = new (Word)ArrayList();
  34. while(inFile.hasMoreTokens())
  35. {
  36. temp = inFile.readToken();
  37.  
  38.  
  39. }
  40.  
  41. }
  42. }
  43.  
  44.  
  45. public class Word
  46. {
  47. private int occurence=1;
  48. private String myWord = "";
  49.  
  50. /**
  51. * Constructor
  52. */
  53. public Word(String word)
  54. {
  55. myWord = word;
  56. }
  57.  
  58. public int getOccur()
  59. {
  60. return occurence;
  61. }
  62.  
  63. public String getWord()
  64. {
  65. return myWord;
  66. }
  67.  
  68. public void increment()
  69. {
  70. occurence++;
  71. }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment