I\'m in java 1 and i need help with this code. please include the code. I apprec
ID: 3668702 • Letter: I
Question
I'm in java 1 and i need help with this code. please include the code. I appreciate your help, thank you.
Programming Concepts
1) switchstatements
2) The char data type
3) whileLoops
Exercise Location
For this exercise, you will copy a program from my directory into yours. It doesn't matter what directory this exercise is located in. You will need to copy this command and paste it into Loki:
cp ~lkoperski/1404_Lab/Exercises/Exercise05.java .
Exercise Description
The code to determine if a letter is a vowel or consonant is already written for you. You must put the code inside a while loop, where the user will continue inputting characters, until a # is entered.
Exercise Requirements
Allow the user to continue inputting characters, until a # is entered.
Do not display the statement: "# is a consonant! "
Explanation / Answer
switch Statement :It take input and action according to the input gives output
switch(input){
case c1: statement1;break;case c2: statement2;break;....case cn: statementn;break;default: default statement when it is not meet the cases
}
char datatype:It accept single character as input, which of size 1 byte.
while loop:Infinite loop.It need a termination condition.
while(condition){
statement;
}
Sample code:
while(n !='#'){
System.out.println("Vowel or consnant");
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.