• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

How to put the vowels and consonants into separate arrays and output the vowels and consonants?

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm having trouble creating an array for vowels and consonants and I can't display the arrays. Please help.

 
Sheriff
Posts: 17085
298
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That code won’t compile and it looks like you’re missing some key understanding about Java program constructs.

When solving problems like this, it’s often helpful to visualize what the output should be from a given input then work your way backwards from there.

For example, if the user enters the string “The quick brown fox jumps” what should the output of the program you want to write be?
 
Scott Baban
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Junilu Lacar wrote:That code won’t compile and it looks like you’re missing some key understanding about Java program constructs.

When solving problems like this, it’s often helpful to visualize what the output should be from a given input then work your way backwards from there.

For example, if the user enters the string “The quick brown fox jumps” what should the output of the program you want to write be?



Made a new one and still having problems with a scanner. Used array list instead.
Staff note (Junilu Lacar) :

Please quote only parts of previous posts that are relevant to your replies. Avoid quoting entire answers, especially if you’re only responding to a part of it.

 
Junilu Lacar
Sheriff
Posts: 17085
298
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Saying “still having problems” is no use to anyone who wants to help you. Please TellTheDetails (← click that, it’s a link)
 
Junilu Lacar
Sheriff
Posts: 17085
298
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, you never answered my question: If the user enters “The quick brown fox jumps” what should the program output be?
 
Scott Baban
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Junilu Lacar wrote:Also, you never answered my question: If the user enters “The quick brown fox jumps” what should the program output be?


Jumps over the lazy dog. Sorry I'm really new confused and I'm new to Java.
 
Scott Baban
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Junilu Lacar wrote:Saying “still having problems” is no use to anyone who wants to help you. Please TellTheDetails (← click that, it’s a link)



Errors like these:
xdd.png
[Thumbnail for xdd.png]
 
Junilu Lacar
Sheriff
Posts: 17085
298
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you can’t clearly explain what your program is supposed to do given some example input, how do you expect to write a program that works? You need to be clear on how the program is supposed to properly process its input.

So, again, if I enter the string “The quick brown fox jumps” what is this program supposed to print out in response?
 
Junilu Lacar
Sheriff
Posts: 17085
298
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Those errors indicate you’re missing an import statement. Whatever class it says it’s not able to resolve, then you need to import it.
 
Junilu Lacar
Sheriff
Posts: 17085
298
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Scott Baban wrote:

Junilu Lacar wrote:Also, you never answered my question: If the user enters “The quick brown fox jumps” what should the program output be?


Jumps over the lazy dog.


That makes no sense at all. If the program is supposed to separate vowels and consonants, how is “Jumps over the lazy dog” the correct output if the user enters “The quick brown fox jumps” as the input string?
 
Junilu Lacar
Sheriff
Posts: 17085
298
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Stop thinking about how to write a Java program for a minute and think about how you would solve this problem by hand first. If you can’t articulate how you’d do it by hand, then how in the world would you be able to tell the computer what to do?
 
Junilu Lacar
Sheriff
Posts: 17085
298
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe if I give an example of what I’m looking for, you’ll get over the mental block you seem to have.

For example, say the user enters “kraaker” as the input string. Should the computer respond with this:

Input: kraaker

Vowels: a a e
Consonants: k r k r

Or should it output this instead:

Input: kraaker

Vowels: a e
Consonants: k r
 
Did you miss me? Did you miss this tiny ad?
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic