Hi ,
how are you?
please, could you help me to solve this question?
which is a part of the compitision's questions.
I am waiting for your respond!

Considering the fact that you have a negative Rep and the fact that you have not even put in the slightest effort to do this assignment on your own made me think ten times before posting this.

The dialog boxes shown in your snapshot can be done using the JOptionPane class. Reading through it you should be able to figure out which dialog to use when.

And as you have not mentioned where you need help, I will leave it at that.

Hi ,
how are you?

I am fine.

please, could you help me to solve this question?

No, Reason ? Your next statement.

which is a part of the compitision's questions.

If this question is part of a competition I simply do not want to provide you with an unfair advantage. If you took part in the competition you may as well figure this out on your own.
You certainly weren't banking on us when you decided to take part in the competition.

I am waiting for your respond!

You can continue to do so !!

import javax.swing.JOptionPane;
public class number_Occurrences {
public static void main(String[]args){
String s= JOptionPane.showInputDialog("please enter asentence");
int []counts= countLetters(s.toLowerCase());


String output="";
for (int i=0; i<counts.length; i++) {
if (counts !=0)
output+=(char)('a'+i)+":"+ counts+((counts==0)?"\n":"\n");
}


JOptionPane.showMessageDialog(null,output);



}


public static int[] countLetters(String s) {
int[] counts=new int[26];


for (int i=0;i <s.length();i++){
if(Character.isLetter(s.charAt(i)))
counts[s.charAt(i)-'a']++;
}
return counts;
}


}

Use code tags

import javax.swing.JOptionPane;
public class number_Occurrences {
public static void main(String[]args){
String s= JOptionPane.showInputDialog("please enter asentence");
int []counts= countLetters(s.toLowerCase());

String output="";
for (int i=0; i<counts.length; i++) {
if (counts[i] !=0)
output+=(char)('a'+i)+":"+ counts[i]+((counts[i]==0)?"\n":"\n");
}

JOptionPane.showMessageDialog(null,output);


}



public static int[] countLetters(String s) {
int[] counts=new int[26];

for (int i=0;i <s.length();i++){
if(Character.isLetter(s.charAt(i)))
counts[s.charAt(i)-'a']++;
}
return counts;
}

}

and .. what is that question you want help with?

see attached file

That looks good to me bahr.

Now all you have to do is rearrange the letters and numbers to the appropriate places and output the one with the most occurences!

I have faith in you!

PO.

see attached file

Hi

? what

see attached file

nowp... if he's to lazy to copy-paste it, I'm to lazy to open a file and read it

nowp... if he's to lazy to copy-paste it, I'm to lazy to open a file and read it

Ditto to that, this thread should be close the amount of laziness astounds me.

well it has screenshots, etc... its not plain text

well it has screenshots, etc... its not plain text

Yep had already checked it, thats why I had suggested the JOptionPane class for getting the dialog boxes, my bet is that he wants us to also post the code for the text processing stuff, which if this program is a part of some competition the thread starter is participating in, I do not think any one should even drop a hint on.

@stephen84s
Yep, that's what my point was since the first post. If this program is a part of a competition, why should we be the ones to provide him unfair advantage.

I don't see how giving suggestions is an unfair advantage, as long as nobody is doing his work for him. I can understand if you're unwilling to help him because he hasn't shown any effort (as I am) but if it's an unfair advantage, then any help given on Daniweb is.

I am not pointing to suggestions but from what this persons approach tells me (as has been pointed out by others here) is he isn't looking for suggestions he is rather looking for ready-made solutions which is certainly unfair advantage in a competition and thats what I am not ready to do.
PS : Replying late since I was out of town.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.