Guest User

Untitled

a guest
Oct 17th, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.61 KB | None | 0 0
  1. package Chapter2;
  2. //Bharddwaj Vemulapalli
  3. //Period 6/7
  4. public class chap2Longwords {
  5.  
  6. public static void main(String[] args) {
  7. // String LW2 = new String("");
  8. String idk = "otorhinolaryngological ";
  9. char letter1 = idk.charAt(0);
  10. int numLtrs = idk.length();
  11. int count = 0;
  12. int count2=0;
  13. for (int k = 0; k < idk.length(); k++) {
  14. if (idk.charAt(k) == letter1) {
  15. count ++;
  16. }
  17. if (idk.charAt(k) == idk.charAt(21)) {
  18. count2++;
  19. }
  20.  
  21. }
  22. int bount = 0;
  23. int bount2 = 0;
  24. int bount3 = 0;
  25. int bount4 = 0;
  26. int bount5 = 0;
  27. int bount6 = 0;
  28. for(int b = 0; b < idk.length(); b++) {
  29. if(idk.charAt(b) == 'a' ) {
  30. bount++;
  31. }
  32. if(idk.charAt(b) == 'e') {
  33. bount2++;
  34. }
  35. if(idk.charAt(b) == 'i') {
  36. bount3++;
  37. }
  38. if(idk.charAt(b) == 'o') {
  39. bount4++;
  40. }
  41. if(idk.charAt(b) == 'u' ) {
  42. bount5++;
  43. }
  44. if(idk.charAt(b) == 'y') {
  45. bount6++;
  46. }
  47. }
  48. System.out.println("otorhinolaryngological");
  49. System.out.println("The number of letters is " + numLtrs);
  50. System.out.println("The first letter repeats " + count + " times");
  51. System.out.println("The last letter repeats " + count2 + " times");
  52. System.out.println("The number of letters is " + idk.length());
  53. System.out.println("The vowel a repeats " + bount + " times");
  54. System.out.println("The vowel e repeats " + bount2 + " times");
  55. System.out.println("The vowel i repeats " + bount3 + " times");
  56. System.out.println("The vowel o repeats " + bount4 + " times");
  57. System.out.println("The vowel u repeats " + bount5 + " times");
  58. System.out.println("The vowel y repeats " + bount6 + " times");
  59.  
  60.  
  61. String word2 = new String("psychoneuroendocrinological");
  62. char letter2 = word2.charAt(0);
  63.  
  64. int numLtrs2 = word2.length();
  65. int dount = 0;
  66. int dount2=0;
  67. for (int a = 0; a < word2.length(); a++) {
  68. if (word2.charAt(a) == letter2) {
  69. dount ++;
  70. }
  71. if (word2.charAt(a) == word2.charAt(26)) {
  72. dount2++;
  73. }
  74.  
  75. }
  76. int eount = 0;
  77. int eount2 = 0;
  78. int eount3 = 0;
  79. int eount4 = 0;
  80. int eount5 = 0;
  81. int eount6 = 0;
  82. for(int z = 0; z < word2.length(); z++) {
  83. if(word2.charAt(z) == 'a' ) {
  84. eount++;
  85. }
  86. if(word2.charAt(z) == 'e') {
  87. eount2++;
  88. }
  89. if(word2.charAt(z) == 'i') {
  90. eount3++;
  91. }
  92. if(word2.charAt(z) == 'o') {
  93. eount4++;
  94. }
  95. if(word2.charAt(z) == 'u' ) {
  96. eount5++;
  97. }
  98. if(word2.charAt(z) == 'y') {
  99. eount6++;
  100. }
  101. }
  102. System.out.println("otorhinolaryngological");
  103. System.out.println("The number of letters is " + numLtrs2);
  104. System.out.println("The first letter repeats " + dount + " times");
  105. System.out.println("The last letter repeats " + dount2 + " times");
  106. System.out.println("The number of letters is " + word2.length());
  107. System.out.println("The vowel a repeats " + eount + " times");
  108. System.out.println("The vowel e repeats " + eount2 + " times");
  109. System.out.println("The vowel i repeats " + eount3 + " times");
  110. System.out.println("The vowel o repeats " + eount4 + " times");
  111. System.out.println("The vowel u repeats " + eount5 + " times");
  112. System.out.println("The vowel y repeats " + eount6 + " times");
  113.  
  114.  
  115. String word3 = new String("spectrophotofluorometrically");
  116. char letter3 = word3.charAt(0);
  117.  
  118. int numLtrs3 = word3.length();
  119. int yount = 0;
  120. int yount2=0;
  121. for (int a = 0; a < word3.length(); a++) {
  122. if (word3.charAt(a) == letter2) {
  123. yount ++;
  124. }
  125. if (word3.charAt(a) == word3.charAt(27)) {
  126. yount2++;
  127. }
  128.  
  129. }
  130. int zount = 0;
  131. int zount2 = 0;
  132. int zount3 = 0;
  133. int zount4 = 0;
  134. int zount5 = 0;
  135. int zount6 = 0;
  136. for(int z = 0; z < word3.length(); z++) {
  137. if(word3.charAt(z) == 'a' ) {
  138. zount++;
  139. }
  140. if(word3.charAt(z) == 'e') {
  141. zount2++;
  142. }
  143. if(word3.charAt(z) == 'i') {
  144. zount3++;
  145. }
  146. if(word3.charAt(z) == 'o') {
  147. zount4++;
  148. }
  149. if(word3.charAt(z) == 'u' ) {
  150. zount5++;
  151. }
  152. if(word3.charAt(z) == 'y') {
  153. zount6++;
  154. }
  155. }
  156. System.out.println("otorhinolaryngological");
  157. System.out.println("The number of letters is " + numLtrs3);
  158. System.out.println("The first letter repeats " + yount + " times");
  159. System.out.println("The last letter repeats " + yount2 + " times");
  160. System.out.println("The number of letters is " + word3.length());
  161. System.out.println("The vowel a repeats " + zount + " times");
  162. System.out.println("The vowel e repeats " + zount2 + " times");
  163. System.out.println("The vowel i repeats " + zount3 + " times");
  164. System.out.println("The vowel o repeats " + zount4 + " times");
  165. System.out.println("The vowel u repeats " + zount5 + " times");
  166. System.out.println("The vowel y repeats " + zount6 + " times");
  167.  
  168.  
  169. }
  170.  
  171. }
Add Comment
Please, Sign In to add comment