Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 hi can anyone help me with this?
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
enteng420




PostPosted: Fri Jun 18, 2010 10:08 pm   Post subject: hi can anyone help me with this?

create a program that accepts the full name of a student. the program should count and display all the vowels and consonants. we cannot use array and the program must loop.

here's the sample output:
Enter student name: John Brown
There are 2 vowels and 7 consonants
Sponsor
Sponsor
Sponsor
sponsor
Euphoracle




PostPosted: Fri Jun 18, 2010 10:26 pm   Post subject: RE:hi can anyone help me with this?

Not doing it for you. Cheers.
TheGuardian001




PostPosted: Sat Jun 19, 2010 12:18 am   Post subject: Re: hi can anyone help me with this?

Help, yes.
Do it, no.
DemonWasp




PostPosted: Sat Jun 19, 2010 1:47 pm   Post subject: RE:hi can anyone help me with this?

Break down the problem. Get a piece of paper and a pencil, and solve the problem yourself. Consider your approach carefully.

You probably looked at each letter one at a time and kept a running tally of consonants and vowels. At the end, all you had to do was look at the tallies you'd kept, and you had your answer.

Now, adapt that so that you can make a computer do it. To look at each letter one at a time, you'll probably want a for loop. To keep a tally of both consonants and vowels, you'll probably need two variables (what type should they be?). Then, you just need a little bit of logic to determine whether each letter is a consonant or a vowel.

You can follow this basic pattern (figure out how you would do it, adapt it for the computer, write the code) for almost every problem you face when programming.
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: