subject

/*
(count vowels and consonants) assume letters a, e, i, o, and u as the vowels.
write a program that prompts the user to enter a string and displays the number
of vowels and consonants in the string.
*/
import java. util. scanner;

public class exercise_05_49 {
public static void main(string[] args) {
scanner input = new scanner(system. in);

// prompt the user to enter a string
system. out. print("enter a string: ");
string string = input. nextline();

int vowels, // count the number of vowels
consonants; // count the number of consonants
vowels = consonants = 0; // initialize accumulators to 0

// count the number of vowels and consonants
for (int i = 0; i < string. length(); i++) {
if (character. isletter(string. charat( {
if (character. touppercase(string. charat(i)) == 'a' ||
character. touppercase(string. charat(i)) == 'e' ||
character. touppercase(string. charat(i)) == 'i' ||
character. touppercase(string. charat(i)) == 'o' ||
character. touppercase(string. charat(i)) == 'u') {
vowels++;
}
else
consonants++;
}

// display results
system. out. println("the number of vowels is " + vowels);
system. out. println("the number of consonants is " + consonants);
}
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 07:30
What part of the interface displays the external references contained in a selected cell? the status bar the review tab the scroll bar the formula bar
Answers: 1
question
Computers and Technology, 23.06.2019 16:30
How to do this programming flowchart?
Answers: 3
question
Computers and Technology, 23.06.2019 17:00
The camera still is bad even with the new iphone xr and especially in low light it is even worst because you can see the pixels more if its in low light. if all you apple customers want apple to fix this then lets fill there feedback with complaints about the
Answers: 1
question
Computers and Technology, 23.06.2019 18:50
What is transmission control protocol/internet protocol (tcp/ip)? software that prevents direct communication between a sending and receiving computer and is used to monitor packets for security reasons a standard that specifies the format of data as well as the rules to be followed during transmission a simple network protocol that allows the transfer of files between two computers on the internet a standard internet protocol that provides the technical foundation for the public internet as well as for large numbers of private networks
Answers: 2
You know the right answer?
/*
(count vowels and consonants) assume letters a, e, i, o, and u as the vowels.
write a...
Questions
question
Business, 14.12.2019 00:31
question
Social Studies, 14.12.2019 00:31
Questions on the website: 13722365