*
The moose likes Beginning Java and the fly likes Java adding infinte strings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

Java adding infinte strings

Ben Peer
Greenhorn

Joined: Apr 21, 2010
Posts: 15
This is the code i have and i need to find a way to add the data inputed together so its all one string like the count++ thing where it adds to the count for each input. so if a 'd' then 'f' then '$' is input the it would add them together in the variable "mixTotal = df$"ot sure how to do this so that it can add strings even if there are 50 or 40 entered.



Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3432
    
  12
You need to add each character to mixTotal inside the loop. You are doing it once afetr the loop has exited. You were closer with your attempt in your first post.

It is better to add any further questions to this post rather than starting a new thread each time - that way everyone can easily see what you have already tried and what suggestions have been made.
Vineet Kakati
Greenhorn

Joined: May 03, 2010
Posts: 21
I would suggest using a character array to enter characters one by one;
I would also suggest the use of functions toUpperCase() and toLowerCase for each entered character;
After entering ,the array should be printed;
Continue entering characters till entered character is not '.';

Refer the changes made to your code as shown below:-
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38107
    
  22
Joanne Neal wrote: . . . It is better to add any further questions to this post rather than starting a new thread each time - that way everyone can easily see what you have already tried and what suggestions have been made.
Agree with Joanne (nice to see you again, by the way, Joanne), so I shall close this thread.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java adding infinte strings
 
Similar Threads
Java String Character Data Entry Program
Help with Java program
how come i can't call my search method from my main method?
parse to double required? variable declarations
Java character input and modification.