subject

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.");

}

}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 03:10
Write a program that begins by reading in a series of positive integers on a single line of input and then computes and prints the product of those integers. integers are accepted and multiplied until the user enters an integer less than 1. this final number is not part of the product. then, the program prints the product. if the first entered number is negative or 0, the program must print “bad input.” and terminate immediately. next, the program determines and prints the prime factorization of the product, listing the factors in increasing order. if a prime number is not a factor of the product, then it must not appear in the factorization. sample runs are given below. note that if the power of a prime is 1, then that 1 must appear in t
Answers: 3
question
Computers and Technology, 23.06.2019 00:10
My has been slow anyone else’s ?
Answers: 1
question
Computers and Technology, 23.06.2019 22:30
Jamie has to enter the names, employee id’s, and income of a group of employees into a worksheet. which option will jamie use to describe the data
Answers: 3
question
Computers and Technology, 24.06.2019 16:00
"gps interaction and cognitive process" respond to the following: imagine that you have been asked to design a gps product that will have voice recognition and bluetooth capability. discuss and conceptualize a user interaction model. predict two (2) problems that may arise in gps products with voice recognition and bluetooth capability. recommend solutions for each of these issues. attention is one of the six cognition processes. when attention is applied to a design, the goal is to make it easier for the end user to quickly locate where he / she should type information on the computer or mobile device screen. compare and contrast how the google search engine and the microsoft bing search engine employ the attention cognition process. provide your opinion as to which search engine better employs the attention cognition process and explain why.
Answers: 3
You know the right answer?
Hello again, just need help debugging-I honestly have no idea how the "isSpace" etc methods work and...
Questions
question
Mathematics, 12.02.2021 17:30
question
Mathematics, 12.02.2021 17:30
question
Mathematics, 12.02.2021 17:30
question
Mathematics, 12.02.2021 17:30
question
Biology, 12.02.2021 17:30
Questions on the website: 13722363