Computers and Technology

Hello again, just need help debugging-I honestly have no idea how the "isSpace" etc methods work and I've tried various syntaxes (string name, Character., etc.) to no avail. Also getting errors for the c= sections for converting between char, string, and boolean which I understand, just dont know how to fix. I'm aware I could condense my initial variables, I just like them laid out. The code aims to count lowercase vowels, all consonants, spaces, and punctuation. Anything else will get thrown into a misc count. import java. util. Scanner;

public class MyClass {

public static void main(String args[]) {
Scanner s=new Scanner(System. in);
System. out. println("input the string");
String as=s. nextLine();

int cons=0;

int a=0;

int e=0;

int i=0;

int o=0;

int u=0;

int space=0;

int punc=0;

char c;

int misc=0;

for(int k=0;k(LESS THAN)as. length();k++){
if(as. isSpace(as. charAt(i))){
space++;
}

else if(as. isConsonant(as. charAt(i))){

cons++;

}

else if(as. isPunctuation(as. charAt(i))){

punc++;

}

else if(as. isVowel(as. charAt(i))){

c=as. charAt(i);

if (c="a"){

a++;

}

else if(c="i"){

i++;

}

else if(c="e"){

e++;

}

else if(c="o"){

o++;

}

else if(c="u"){

u++;

}

else{

misc++;

}

}

else{

misc++;

}

}

System. out. println(a+" a's");

System. out. println(e+" e's");

System. out. println(i+" i's");

System. out. println(o+" o's");

System. out. println(u+" u's");

System. out. println(space+" spaces");

System. out. println(punc+" punctuations");

System. out. println(cons+" consonants");

System. out. println(misc+" misc. (uppercase vowels, etc.");

}

}

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 22:00, luisanavarrogarcia
Which of the following statements correctly identifies a problem with sanitization methods? a. methods are not available to remove data ensuring that unauthorized personnel cannot retrieve data. b. even fully incinerated media can offer extractable data. c. personnel can perform sanitization steps improperly. d. stored data is physically etched into the media.
Answers: 1
image
Computers and Technology, 23.06.2019 06:20, kiarakagni
What is a point-in-time measurement of system performance?
Answers: 3
image
Computers and Technology, 23.06.2019 10:20, chonawilson4
Suppose there is a relation r(a, b, c) with a b+-tree index with search keys (a, b).1. what is the worst-case cost of finding records satisfying 10 < a < 50 using this index, in terms of the number of records n1, retrieved and the height h of the tree? 2. what is the worst-case cost of finding records satisfying 10 < a < 50 and 5 < b < 10 using this index, in terms of the number of records n2 that satisfy this selection, as well as n1 and h defined above? 3. under what conditions on n1 and n2, would the index be an efficient way of finding records satisfying the condition from part (2)?
Answers: 1
image
Computers and Technology, 23.06.2019 13:10, BrianKeokot4534
What is domain name system (dns)? allows dynamic ip address allocation so users do not have to have a preconfigured ip address to use the network converts ip addresses into domains, or identifying labels that use a variety of recognizable naming conventions the efficient coexistence of telephone, video, and data communication within a single network, offering convenience and flexibility not possible with separate infrastructures the integration of communication channels into a single service
Answers: 2
Do you know the correct answer?
Hello again, just need help debugging-I honestly have no idea how the "isSpace" etc methods work and...

Questions in other subjects:

Konu
Mathematics, 04.12.2020 19:40
Konu
History, 04.12.2020 19:40
Konu
English, 04.12.2020 19:40