1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Vlad1618 [11]
2 years ago
13

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


}

}
Computers and Technology
1 answer:
Julli [10]2 years ago
5 0

import java.util.Scanner;

public class JavaApplication81 {

   

   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;

       String punctuation = ".!,?";

       String consonants = "bcdfghjklmnpqrstvwxyz";

       for (int k = 0; k < as.length(); k++){

           c = as.charAt(k);

       if (Character.isWhitespace(c)){

           space ++;

       }

       else if (punctuation.indexOf(c) != -1){

           punc++;

       }

       else if (consonants.indexOf(c) != -1){

           cons++;

       }

       else if (c == 'a'){

           a++;

       }

       else if(c == 'e'){

           e++;

       }

       else if (c == 'i'){

           i++;

       }

       else if (c == 'o'){

           o++;

       }

       else if (c == 'u'){

           u++;

       }

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

   }

   

}

This is one example of how it could be done.

You might be interested in
What is that black thing on my wall?
Darya [45]
I'm guessing your television if it's a flat screen
7 0
2 years ago
Della is a special education teacher. In her classroom, students may use many different types of utility programs to make it eas
Assoli18 [71]

Answer:

accessibility

Explanation:

Della is a special education teacher. In her classroom, students may use many different types of utility programs to make it easier for them to use their computers. This category of utility software is known as accessibility.

6 0
3 years ago
Read 2 more answers
Which of these are examples of data sources? Check all that apply.
Rama09 [41]

Answer: databases, electronic archives, online libraries, spreadsheets (B,C,E,F)

Explanation: I just took the test :)) hope u have a great day and remeber u are beautiful <3

4 0
2 years ago
Read 2 more answers
How can you make the drawing tools contextual tab appear
Anestetic [448]

Answer:

Following up on Stefan's repsonse, this means that first, from the Insert tab you need to insert a line or shape. Once you've inserted something, select it and the contextual tab DRAWING TOOLS - FORMAT will appear.

Explanation:

3 0
2 years ago
Read 2 more answers
PLZ HELP HELP HELP ME I NEED ANSWER MATH​
irina [24]

The first one is 0 (0/3=0)

The second one is 3 (3/3=1)

The third one is 2 (6/3=2)

The fourth one is 9 (9/3=3)

Hope this helps you :)

4 0
3 years ago
Read 2 more answers
Other questions:
  • Which of the following is the largest disadvantage of hydropower?
    8·2 answers
  • You are a psychologist who needs to provide a qualitative evaluation for IQ scores. Create a program that takes IQ scores (one a
    10·1 answer
  • if you want to present slides to fellow students and co-workers which productivity software should you use to create them?
    13·1 answer
  • How has technology affected the way that you produce art like photographs?
    8·1 answer
  • Rate is how fast a screen updates the information being displayed.
    6·2 answers
  • What are the OSHA construction standards also called ?
    10·1 answer
  • What is star topology
    15·2 answers
  • The steps.txt file contains the number of steps a person has taken each day for a year. There are 365 lines in the file, and eac
    12·1 answer
  • SUB2 WWolfPlays on yt <br><br><br> true or false if false ima cri
    8·2 answers
  • Please help me on this match all this up i’ll give you brainlist
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!