• Post Reply Bookmark Topic Watch Topic
  • New Topic

Count no: letters in each word of a sentence  RSS feed

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy!

Just starting with my interview preparation as I would be graduating this December. I did little search to test my java skills and I must admit I might start coding and learn Java to clear the interviews. The most common questions are my first take and I ended up confusing myself. Hope you guys would help me and guide me to understand the way I must think to solve the following questions!

1.) Count the number of characters in each word of a sentence.
[ I created a function which counts the total number of characters in a sentence. But I wanted the output to be "I am fit for this job!" : "1 2 3 3 4 4". How to count two words from a same sentence
2.) I am kinda embarrassed to ask this still I tot knowing what the concept is more important than seeing the errors! How will you read a log file which is / delimited
3.) And how will you display the info in the log file by their corresponding category. That is assume the log file has name, item, price. Some may purchase mobile. some buys tv. So customer a buys mobile for 10 bucks and tc for 15 buck. next customer buys only tv for 25 bucks.

Wish I could have started knowing java before! I was more into sports than my actual major Nevertheless I am sure I will learn and clear my first interview!

Thank you folks in advance!
 
Sheriff
Posts: 11494
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm assuming it's something computer related but if you don't mind my asking, what degree are you going to graduate with? And why are you only now learning how to program Java? What have they been teaching you all this time?
 
Chandra Swaminathan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Junilu Lacar wrote:I'm assuming it's something computer related but if you don't mind my asking, what degree are you going to graduate with? And why are you only now learning how to program Java? What have they been teaching you all this time?


I am graduating in computer engineering. I am a badminton player and it was my priority until I had this tennis elbow fractures. I can't play anymore
Since now I am graduating and to support my family and kids I wanted to learn java and get a job at my uncle's start-up. But I really dont want to join or do the work without any proper knowledge or by searching in google. I thought I can use this 6 months to learn and gain proper knowledge. Thus I would make him feel that I am fit for this position.

I am sorry if my questions were too simple and must-known. To be honest I am just starting from the very basics.
 
Junilu Lacar
Sheriff
Posts: 11494
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On my team, we give out an award to developers who can demonstrate "Mad Googling Skills" -- that is, if they can find a GOOD, VALID solution quickly by simply Googling for it, they get recognized for their resourcefulness.

Good luck with your Java study.
 
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you know nothing, find a good book. Many folks here recommend "Head First Java".

We don't really give out answers here (i.e. don't expect someone to give you the program), but will help guide you to the answer. So, in that spirit...how would YOU, personally, count the number of characters in each word of a sentence?

Try writing the steps down. Make them clear and precise, such that you could hand the directions to anyone and they'd know what you mean. For example...What constitutes a word? What do you do with punctuation?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!