i'm stuck on this assignment i've got.
what i'm meant to do is ask the user how many vowels they would like to enter. read the vowel from the user and print how many times the vowel was put in a repetition. and stop either wen the loop is over or the user inputs #
an example of how its ment to be:
How many vowels would you like to read in? 30 Please enter a vowel (a,e,i,o,u) (30 max), # to quit: a Please enter a vowel (a,e,i,o,u) (30 max), # to quit: a Please enter a vowel (a,e,i,o,u) (30 max), # to quit: e Please enter a vowel (a,e,i,o,u) (30 max), # to quit: e Please enter a vowel (a,e,i,o,u) (30 max), # to quit: i Please enter a vowel (a,e,i,o,u) (30 max), # to quit: a Please enter a vowel (a,e,i,o,u) (30 max), # to quit: e Please enter a vowel (a,e,i,o,u) (30 max), # to quit: i Please enter a vowel (a,e,i,o,u) (30 max), # to quit: o Please enter a vowel (a,e,i,o,u) (30 max), # to quit: # there are 3 a's in the array, the first appearing in index 0. there are 3 e's in the array, the first appearing in index 2. there are 2 i's in the array, the first appearing in index 4. there are 1 o's in the array, the first appearing in index 8. there are no u's in the array!this is my code so far:
B102 was provided by university so that i can use Scree.out.println(); and use max= Keybd.in.readInt(); to read max from the println.
import B102.*;
public class CountVowel {
int aFirst, eFirst, iFirst, oFirst, uFirst;
int aNum, eNum, iNum, oNum, uNum;
int max;
int ReadVowel;
public static void main(String [] args){
CountVowel cv = new CountVowel();
cv.readMaxCount();
cv.readVowels();
cv.printOutPut();
}
public void printOutPut() {
Screen.out.println("there are a's in the array, the first appearing in index .");
Screen.out.println("there are e's in the array, the first appearing in index .");
Screen.out.println("there are i's in the array, the first appearing in index .");
Screen.out.println("there are o's in the array, the first appearing in index .");
Screen.out.println("there are u's in the array, the first appearing in the index .");
}
public void readVowels() {
Screen.out.println("Please enter a vowel (a,e,i,o,u) ('+max' max), # to quit:" +ReadVowel);
ReadVowel=Keybd.in.readInt();
if(ReadVowel=='a')//how would i store this into an array and output it above
if(ReadVowel=='e')//how would i store this into an array and output it above
if(ReadVowel=='i')//how would i store this into an array and output it above
if(ReadVowel=='o')//how would i store this into an array and output it above
if(ReadVowel=='u');//how would i store this into an array and output it above
}
public void readMaxCount() {
max= Keybd.in.readInt();
Screen.out.println("How many vowels would you like to read in?" +max);
}
}
how do i store 'a' in the array and store it. then output it later?
if the user input's a store in array x or something like that.
I'm very new to java and understand very little of it.
so even my explanation above might be hard to understand.


Sign In
Create Account


Back to top









