Array list or character ? in java

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Sep 2009
Posts: 3
Reputation: ayaz.ali is an unknown quantity at this point 
Solved Threads: 0
ayaz.ali ayaz.ali is offline Offline
Newbie Poster

Array list or character ? in java

 
0
  #1
Sep 18th, 2009
I want to create a a program in which i enter a word and the program counts the number of alphabets used in the word and display as output !!
I know its simple but i am just a beginner and my teacher wants to submit this as assignment


this is the question
2. A man wanted to enter a club but did not know the password that was required. He waited by the door and listend, a club member knocked on the door, the door man said "twelve" member replied "6" and was let in. Second member came to the door, doorman said "six" the member replied "3" and was let in. now the man throught that he had heard enough and walked up to the door, doorman said "eight" the man replied "4" but he was not let in. What should he say? so that he gets in.
Last edited by ayaz.ali; Sep 18th, 2009 at 4:28 am. Reason: question added
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 87
Reputation: freelancelote is an unknown quantity at this point 
Solved Threads: 2
freelancelote's Avatar
freelancelote freelancelote is offline Offline
Junior Poster in Training

Re: Array list or character ? in java

 
0
  #2
Sep 18th, 2009
and your problem being...?
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 3
Reputation: ayaz.ali is an unknown quantity at this point 
Solved Threads: 0
ayaz.ali ayaz.ali is offline Offline
Newbie Poster

Re: Array list or character ? in java

 
0
  #3
Sep 18th, 2009
i have no clue how to do it ??
i only started working a week ago i just know how to introduce integer and if and else and print hello world :p
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 87
Reputation: freelancelote is an unknown quantity at this point 
Solved Threads: 2
freelancelote's Avatar
freelancelote freelancelote is offline Offline
Junior Poster in Training

Re: Array list or character ? in java

 
0
  #4
Sep 18th, 2009
the program counts the number of alphabets used in the word and display as output !!
I'm guessing that by "the number of alphabets" you mean the number of letters your word has. If I'm guessing wright then use length() method of the String class.
Hava a look at the String class and at the trails.





2. A man wanted to enter a club but did not know the password that was required. He waited by the door and listend, a club member knocked on the door, the door man said "twelve" member replied "6" and was let in. Second member came to the door, doorman said "six" the member replied "3" and was let in. now the man throught that he had heard enough and walked up to the door, doorman said "eight" the man replied "4" but he was not let in. What should he say? so that he gets in.
What do you mean by that? Is it some kind of joke I didn't get?
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 3,584
Reputation: jasimp has a spectacular aura about jasimp has a spectacular aura about jasimp has a spectacular aura about 
Solved Threads: 52
Featured Poster
jasimp's Avatar
jasimp jasimp is offline Offline
Senior Poster

Re: Array list or character ? in java

 
0
  #5
Sep 18th, 2009
Originally Posted by freelancelote View Post
What do you mean by that? Is it some kind of joke I didn't get?
That is the example for his problem.
"Argyou not with the hand you are dealt in cards or life." ---- Wizard and Glass
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 87
Reputation: freelancelote is an unknown quantity at this point 
Solved Threads: 2
freelancelote's Avatar
freelancelote freelancelote is offline Offline
Junior Poster in Training

Re: Array list or character ? in java

 
0
  #6
Sep 18th, 2009
That is the example for his problem.
ah!, it was too late in the morning!
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 1,435
Reputation: firstPerson is just really nice firstPerson is just really nice firstPerson is just really nice firstPerson is just really nice firstPerson is just really nice 
Solved Threads: 187
firstPerson's Avatar
firstPerson firstPerson is offline Offline
Nearly a Posting Virtuoso

Re: Array list or character ? in java

 
0
  #7
Sep 18th, 2009
he should say 5, by the way.
1) Prove that the area of a circle is pi*r^2, where "r" is the radius of the circle.
2) Problem 2[b]solved by : jonsca
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 87
Reputation: freelancelote is an unknown quantity at this point 
Solved Threads: 2
freelancelote's Avatar
freelancelote freelancelote is offline Offline
Junior Poster in Training

Re: Array list or character ? in java

 
0
  #8
Sep 18th, 2009
Originally Posted by firstPerson View Post
he should say 5, by the way.
ah! right! now I see why I never got into a club!
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 1
Reputation: rouhaifa is an unknown quantity at this point 
Solved Threads: 0
rouhaifa rouhaifa is offline Offline
Newbie Poster

Re: Array list or character ? in java

 
0
  #9
Sep 18th, 2009
this is the answer about the count:

int counter (string s){
count=0;
for (int i=1;int i<s.length();i++)
count ++;
return count;
}
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 4,508
Reputation: Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future 
Solved Threads: 522
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: Array list or character ? in java

 
0
  #10
Sep 18th, 2009
Originally Posted by rouhaifa View Post
this is the answer about the count:

int counter (string s){
count=0;
for (int i=1;int i<s.length();i++)
count ++;
return count;
}
Um, no... just no.
Reply With Quote Quick reply to this message  
Reply

Tags
array, character, java

Message:


Thread Tools Search this Thread



Tag cloud for array, character, java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC