Write the following methods and test them.this need to be execute it in Eclipse IDE for Java Developers
1. printVowels - this method should take a String as a parameter and print all the vowels contained in that String one character per line.
2. printConsonants - this method should take a String as a parameter and print all the consanants contained in that String one character per line.
3. printDigits - this method should take a String as a parameter and print all the numeric digits contained in that String one character per line.
4. processExpression - this method should take a String in the format: "integer [[+-*/] integer]*]" Your method should then process this expression and return the result as an integer. You must solve this problem using ONLY tools that were taught thus far in CSC535.
Examples:
"125" -> 125
"125 + 7" -> 132
"125 + 7 - 2" -> 130
"125 * 2" -> 250
"10 / 3" -> 3
and this what i take so far
cou;d you please make the answer easy because i am beginner in programming and use just this code this is what i took so far
while
if
boolen
not!
<
<=
>
=>
==
!=
or//
and &&
String
int length()
char chaeAt(int index)
string to Upper Case()
string to Lower Case()
mathod(subroutines, procedures, functiond)
return_type methodName(comma_delim_list of params)
{
//do stuff
}
this assignment is java language
1 answer
However, the best and probably the only way to learn is to code a problem yourself. You will have to make mistakes (code), find mistakes (debug), make corrections and recompile and run your programme.
In that respect, I would welcome posts of any code that works or does not work. I can help you point in the right direction as you go on.
I could write the code, and you will compile and submit to your teacher, but you will not have learned anything about the code-debug-run cycle.
To help you get started, I will show you a method that will print the letters A, B and C from a given string.
public static void printABC(String s){
int index=0; // points to each character
String S=s.toUpperCase(); // compare only in uppercase
while(index<s.length()){ // loop through each character of the string
if(S.charAt(index)=='A')System.out.println(s.charAt(index)); // print original character
else if(S.charAt(index)=='B') System.out.println(s.charAt(index));
else if(S.charAt(index)=='C') System.out.println(s.charAt(index));
index++;
}
}
Try to understand every statement of the example. If you do, you will have no problem coding your method. If you don't, feel free to post and request explanations on the part that you do not understand.