Skip to content

Instantly share code, notes, and snippets.

@bharddwaj
Created October 16, 2017 19:19
Show Gist options
  • Select an option

  • Save bharddwaj/29c8c9a408d1f14104acb962bd28672f to your computer and use it in GitHub Desktop.

Select an option

Save bharddwaj/29c8c9a408d1f14104acb962bd28672f to your computer and use it in GitHub Desktop.
package Chapter2;
//Bharddwaj Vemulapalli
//Period 6/7
public class chap2Longwords {
public static void main(String[] args) {
// String LW2 = new String("");
String idk = "otorhinolaryngological ";
char letter1 = idk.charAt(0);
int numLtrs = idk.length();
int count = 0;
int count2=0;
for (int k = 0; k < idk.length(); k++) {
if (idk.charAt(k) == letter1) {
count ++;
}
if (idk.charAt(k) == idk.charAt(21)) {
count2++;
}
}
int bount = 0;
int bount2 = 0;
int bount3 = 0;
int bount4 = 0;
int bount5 = 0;
int bount6 = 0;
for(int b = 0; b < idk.length(); b++) {
if(idk.charAt(b) == 'a' ) {
bount++;
}
if(idk.charAt(b) == 'e') {
bount2++;
}
if(idk.charAt(b) == 'i') {
bount3++;
}
if(idk.charAt(b) == 'o') {
bount4++;
}
if(idk.charAt(b) == 'u' ) {
bount5++;
}
if(idk.charAt(b) == 'y') {
bount6++;
}
}
System.out.println("otorhinolaryngological");
System.out.println("The number of letters is " + numLtrs);
System.out.println("The first letter repeats " + count + " times");
System.out.println("The last letter repeats " + count2 + " times");
System.out.println("The number of letters is " + idk.length());
System.out.println("The vowel a repeats " + bount + " times");
System.out.println("The vowel e repeats " + bount2 + " times");
System.out.println("The vowel i repeats " + bount3 + " times");
System.out.println("The vowel o repeats " + bount4 + " times");
System.out.println("The vowel u repeats " + bount5 + " times");
System.out.println("The vowel y repeats " + bount6 + " times");
String word2 = new String("psychoneuroendocrinological");
char letter2 = word2.charAt(0);
int numLtrs2 = word2.length();
int dount = 0;
int dount2=0;
for (int a = 0; a < word2.length(); a++) {
if (word2.charAt(a) == letter2) {
dount ++;
}
if (word2.charAt(a) == word2.charAt(26)) {
dount2++;
}
}
int eount = 0;
int eount2 = 0;
int eount3 = 0;
int eount4 = 0;
int eount5 = 0;
int eount6 = 0;
for(int z = 0; z < word2.length(); z++) {
if(word2.charAt(z) == 'a' ) {
eount++;
}
if(word2.charAt(z) == 'e') {
eount2++;
}
if(word2.charAt(z) == 'i') {
eount3++;
}
if(word2.charAt(z) == 'o') {
eount4++;
}
if(word2.charAt(z) == 'u' ) {
eount5++;
}
if(word2.charAt(z) == 'y') {
eount6++;
}
}
System.out.println("otorhinolaryngological");
System.out.println("The number of letters is " + numLtrs2);
System.out.println("The first letter repeats " + dount + " times");
System.out.println("The last letter repeats " + dount2 + " times");
System.out.println("The number of letters is " + word2.length());
System.out.println("The vowel a repeats " + eount + " times");
System.out.println("The vowel e repeats " + eount2 + " times");
System.out.println("The vowel i repeats " + eount3 + " times");
System.out.println("The vowel o repeats " + eount4 + " times");
System.out.println("The vowel u repeats " + eount5 + " times");
System.out.println("The vowel y repeats " + eount6 + " times");
String word3 = new String("spectrophotofluorometrically");
char letter3 = word3.charAt(0);
int numLtrs3 = word3.length();
int yount = 0;
int yount2=0;
for (int a = 0; a < word3.length(); a++) {
if (word3.charAt(a) == letter2) {
yount ++;
}
if (word3.charAt(a) == word3.charAt(27)) {
yount2++;
}
}
int zount = 0;
int zount2 = 0;
int zount3 = 0;
int zount4 = 0;
int zount5 = 0;
int zount6 = 0;
for(int z = 0; z < word3.length(); z++) {
if(word3.charAt(z) == 'a' ) {
zount++;
}
if(word3.charAt(z) == 'e') {
zount2++;
}
if(word3.charAt(z) == 'i') {
zount3++;
}
if(word3.charAt(z) == 'o') {
zount4++;
}
if(word3.charAt(z) == 'u' ) {
zount5++;
}
if(word3.charAt(z) == 'y') {
zount6++;
}
}
System.out.println("otorhinolaryngological");
System.out.println("The number of letters is " + numLtrs3);
System.out.println("The first letter repeats " + yount + " times");
System.out.println("The last letter repeats " + yount2 + " times");
System.out.println("The number of letters is " + word3.length());
System.out.println("The vowel a repeats " + zount + " times");
System.out.println("The vowel e repeats " + zount2 + " times");
System.out.println("The vowel i repeats " + zount3 + " times");
System.out.println("The vowel o repeats " + zount4 + " times");
System.out.println("The vowel u repeats " + zount5 + " times");
System.out.println("The vowel y repeats " + zount6 + " times");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment