willieshi232

Untitled

Dec 2nd, 2015
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. 2.
  2. import java.io.*;
  3. import java.util.*;
  4. public class Project1
  5. {
  6. public static void main(String [] args)
  7. {
  8. Scanner Kyogre = new Scanner(new File("paper.txt");
  9. int Linecount = 1
  10. int Wordcount = 1
  11. while(Kyogre.hasNextLine())
  12. {
  13. Linecount++;
  14. Scanner pikachu = new Scanner(Kyogre.nextLine());
  15. if(pikachu.hasNext())
  16. {
  17. Wordcount++;
  18. }
  19. }
  20. System.out.print("You have" + Lines + "lines in your paper, and have" + Wordcount + "words.");
  21. }
  22. }
  23. 4.
  24. import java.util.*;
  25. import java.io.*;
  26. import java.applet.*;
  27. import java.awt.*;
  28. public class babyNames
  29. {
  30. public static void main(String [] args)
  31. throws FileNotFoundException
  32. {
  33. Scanner pikachu = new Scanner(System.in);
  34. Scanner Kyogre = new Scanner(new File("names2.txt"));
  35. System.out.println("This program allows you to search through the \ndata from the Social Security Administration \n to see how popular a particular name has een\n since 1940.");
  36. System.out.print("Name?");
  37. String Espeon = pikachu.next();
  38. int year = 1940;
  39. System.out.println("Statistics on name \""+ Espeon + "\"");
  40. while(Kyogre.hasNextLine())
  41. {
  42. Scanner Shaymin = new Scanner(Kyogre.nextLine());
  43. String Darkrai = Shaymin.next();
  44. if(Darkrai == Espeon)
  45. {
  46. String Glaceon = Shaymin.next();
  47. System.out.print("\t" + year + ":" + Glaceon);
  48. year = year + 10;
  49. }
  50. else
  51. {
  52. System.out.print("");
  53. }
  54. }
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment