Please help me this program

Please help me with this program,the progarm should operates as follows
1)Calculate the number of words
2)Calculate the number of sentences
3)Calculate the repeated words
* Title: <p>
* Description: <p>
* Copyright: Copyright (c) cds<p>
* Company: s<p>
* @author cds
* @version 1.0
package count;
import java.awt.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;
import javax.swing.border.*;
import java.util.StringTokenizer;
public class Frame1 extends JFrame {
JPanel jPanel1 = new JPanel();
XYLayout xYLayout1 = new XYLayout();
XYLayout xYLayout2 = new XYLayout();
JScrollPane jScrollPane1 = new JScrollPane();
JTextArea jta1 = new JTextArea();
JScrollPane jScrollPane2 = new JScrollPane();
JTextArea jta2 = new JTextArea();
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JButton jbtCountSentances = new JButton();
JButton jbtCountWords = new JButton();
JButton jbtRWords = new JButton();
JButton jbtClearList = new JButton();
JTextField jtfNumOfSentances = new JTextField();
JLabel jLabel3 = new JLabel();
JLabel jLabel4 = new JLabel();
JTextField jtfNumOfWords = new JTextField();
private JFileChooser jFileChooser = new JFileChooser();
public static String sentence,RepeatedWords,repwords,chr=" ";
     public static int i,words,token,periods,characters,len,long_word,long_sent,stop;
//Construct the frame
public Frame1() {
try {
jbInit();
catch(Exception e) {
e.printStackTrace();
}setSize(600,400);
show();
public static void main(String[] args) {
Frame1 frame1 = new Frame1();
private void jbInit() throws Exception {
jPanel1.setLayout(xYLayout1);
this.getContentPane().setLayout(xYLayout2);
jLabel1.setForeground(Color.blue);
jLabel1.setText(" Type your Doc");
jLabel2.setForeground(Color.blue);
jLabel2.setText(" Reapeated Words");
jbtCountSentances.setBackground(Color.white);
jbtCountSentances.setForeground(Color.blue);
jbtCountSentances.setText("Count Sentances");
jbtCountSentances.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
jbtCountSentances_actionPerformed(e);
jbtCountWords.setBackground(Color.white);
jbtCountWords.setForeground(Color.blue);
jbtCountWords.setText("Count Words");
jbtCountWords.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
jbtCountWords_actionPerformed(e);
jbtRWords.setBackground(Color.white);
jbtRWords.setForeground(Color.blue);
jbtRWords.setText("Reapeted Words");
jbtRWords.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
jbtRWords_actionPerformed(e);
jbtClearList.setBackground(Color.white);
jbtClearList.setForeground(Color.blue);
jbtClearList.setText("Clear");
jbtClearList.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
jbtClearList_actionPerformed(e);
jLabel3.setForeground(Color.blue);
jLabel3.setText("NumOfSentances");
jLabel4.setForeground(Color.blue);
jLabel4.setText("NumOfWords");
jPanel1.setBackground(SystemColor.activeCaption);
jPanel1.setForeground(SystemColor.activeCaption);
this.getContentPane().add(jPanel1, new XYConstraints(4, 4, 986, 469));
jPanel1.add(jScrollPane1, new XYConstraints(5, 105, 289, 192));
jScrollPane1.getViewport().add(jta1, null);
jPanel1.add(jScrollPane2, new XYConstraints(309, 102, 256, 193));
jScrollPane2.getViewport().add(jta2, null);
jPanel1.add(jLabel1, new XYConstraints(21, 81, 240, 22));
jPanel1.add(jLabel2, new XYConstraints(340, 78, 191, 20));
jPanel1.add(jbtCountSentances, new XYConstraints(69, 309, 190, 30));
jPanel1.add(jbtCountWords, new XYConstraints(69, 339, 190, 24));
jPanel1.add(jbtClearList, new XYConstraints(262, 337, 173, 26));
jPanel1.add(jbtRWords, new XYConstraints(262, 310, 174, 24));
jPanel1.add(jLabel3, new XYConstraints(14, 37, 105, 20));
jPanel1.add(jtfNumOfSentances, new XYConstraints(114, 37, 64, 23));
jPanel1.add(jLabel4, new XYConstraints(212, 38, 82, 23));
jPanel1.add(jtfNumOfWords, new XYConstraints(304, 35, 83, 27));
void jbtCountSentances_actionPerformed(ActionEvent e) {
BufferedReader stdin = new BufferedReader
               (new InputStreamReader (System.in));
sentence = jta1.getText();
          System.out.flush ();
          len=sentence.length();
jtfNumOfSentances.setText(String.valueOf(num_periods()));
public static int num_periods () {
          i=0;
          periods=3;
          chr= ".";
chr= "!";
chr= "?";
          while (i<len){
               if (sentence.charAt(i)==chr.charAt(0))
                    periods++;
               i++;
     return periods;
     }//Method num_words
void jbtCountWords_actionPerformed(ActionEvent e) {
String s = jta1.getText();
StringTokenizer st = new StringTokenizer(s);
jtfNumOfWords.setText(String.valueOf(st.countTokens()));
void jbtRWords_actionPerformed(ActionEvent e) {
repwords = jta1.getText();
StringTokenizer st = new StringTokenizer(repwords);
          while (st.hasMoreTokens())
RepeatedWords = st.nextToken(st.toString()) ;
     jta2.append(RepeatedWords);
     //}//Method num_words
/*void jbtClearList_actionPerformed(ActionEvent e) {
jta2.setText(null);
void jbtHelp_actionPerformed(ActionEvent e) {
jta1.append("Please open a File Write a document");
// JScrollPane jScrollPane1 = new JScrollPane();
//JTextArea jta1 = new JTextArea();
// JScrollPane jScrollPane2 = new JScrollPane();
//JTextArea jta2 = new JTextArea();
void jbtClearList_actionPerformed(ActionEvent e) {
jta2.setText(null);
jta1.setText(null);
jtfNumOfWords.setText(null);
jtfNumOfSentances.setText(null);

Let me try specify the main problem in details
The code that i had posted displays an interface consisting of a 2 textarea.
The first textarea is for a user to enter a sentence and the second is for displaying duplicated words.
The program should allow the user to enter a sentence on the first textarea and when JButton named showduplicatedwords pressed it must display the words that are being duplicated in the sentence on the second textarea.And again count the number of sentence available when
JButton countsentence is pressed

Similar Messages

  • Please help on this program

    Dear Friends,
    With the help of this program I am trying to connect two instruments (One is CM110 monochromator of Spectral products and another one is from Keithley 2400 source meter) with the same programs. With the help of this program I am trying to increase the wavelength of the monochromator by say 10 nm and want to read the current at applied source meter voltage. 
    But the problem is each execution of while loop it is keeping ON/OFF the souce meter applied voltage . I want to keep the applied source meter voltage on through out the whole while loop and read the current, but I am not able to do so.
    Please help me. For your further information I am attaching the LabVIEW Program.
    Thanks in anticipation
    Regards
    Upendra Pandey
    Attachments:
    p2_for_1.vi ‏25 KB

    Chemical,
    You may want to try initializing and closing the Keithley outside of the main loop.  Regards, -SS 

  • Please help find the program

    Please help find the program to block unwanted number, call and SMS, that not all block number ,but  the number on which you want to.

    Which part of "The 5310 is just a java phone that cannot support applications like this." did you not understand?
    If you want to achieve any form of blocking at all, it won't be with that phone. Your operator may be able to help by putting a block in place on their end, though, but I doubt it.
    Was this post helpful? If so, please click on the white "Kudos!" star below. Thank you!

  • Search criteria is not working in Responsible Group field in sap crm could you please help me this how to achieve.

    search criteria is not working in Responsible Group field in sap crm could you please help me this how to achieve.I have writen code on EH_ONSEARCH .as per below...what changess i need to do..and through partner function and adding the selection params please send the sample .
    code. partner funtction - ZRG DATA :
    DATA : lv_partner_fct type .
    types: begin of ty_resp,
           partner    type but000-partner,
           name_last  type but000-name_last,
           name_first type but000-name_first,
           mc_name1   type but000-mc_name1,
           mc_name2   type but000-mc_name2,
           end of ty_resp.
    DATA: lv_resp_bp type STANDARD TABLE OF ty_resp INITIAL SIZE 0,
           lw_resp_bp type ty_resp.
    IF lv_attr_name = 'Rgroup'.
    lr_entity->get_property_as_value( EXPORTING iv_attr_name = if_crm_srqm_uiu_const=>gc_attr_low
                                       IMPORTING ev_result = lv_low ).
    IF lv_low IS INITIAL.
    SELECT partner
           name_last
           name_first
           mc_name1
          mc_name2
    FROM but000 INTO table lv_resp_bp
    WHERE mc_name2 = lv_low and bu_group = '0010'.
    loop at lv_resp_bp into lw_resp_bp.
        lv_low = lw_resp_bp-mc_name2.
      lr_query_service2->add_selection_param( iv_attr_name = 'Rgroup'
                                                iv_sign = lv_sign
                                                iv_option = lv_option
                                                iv_low = lv_low
                                                iv_high = lv_high ).
      ENDLOOP.
    if lv_partner_fct = 'ZRG'.
      lr_entity = lr_iterator->get_next( ).
    CONTINUE.
    ENDIF.
    lv_attr_name = 'BU_PARTNER'.
    ENDIF.

    <b>You can acheive   this .... first by creating the search help exit    ... by  creating the maintaince  view   then   using it in the   Creation of the search help </b> ...
    see the link for attaching the view   to the serach help .
    <a href="http://">http://www.sapdevelopment.co.uk/dictionary/shelp/shelp_elementary.htm</a>
    reward  points if it is usefull...
    Girish

  • When trying to verify the email address, I get the following message. Please help. This email address is already in use or you may already have an Apple ID associated with this email address. Please try again or sign in using your existing Apple ID.

    When trying to verify the email address, I get the following message. Please help. This email address is already in use or you may already have an Apple ID associated with this email address. Please try again or sign in using your existing Apple ID.

    Me too. I try to verify and i get the same message.
    I've created 3 alternate e-mail addresses and tried creating new accounts.
    Same Result!
    This is bullsh!t. How the **** can all 4 of my attempts result in the same freakin error???

  • I just bought a new iPhone and accidentally backed it up with my old iPhone backup, I do not want this. I lost everything on my new phone and I need it back. PLEASE HELP! This includes pictures and texts, etc.

    I just bought a new iPhone and accidentally backed it up with my old iPhone backup, I do not want this. I lost everything on my new phone and I need it back. PLEASE HELP! This includes pictures and texts, etc.

    So just to be clear, when you say "just bought" how long ago was that? Is it on this new iPhone that you had pictures, texts, etc that you want? Were you backing up to iCloud or onto iTunes?
    This may not help for everything but if you go to iCloud.com and log in, are you able to find your pictures there?

  • Every time I sync my Iphone 5c(with ios 8) to Itunes, it 1. deletes all of my purchased music 2. deletes all of my album artwork 3. replaces all of my deleted songs. please help! this is driving me crazy!

    Every time I sync my Iphone 5c(with ios 8) to Itunes, it 1. deletes all of my purchased music 2. deletes all of my album artwork 3. replaces all of my deleted songs. please help! this is driving me crazy! It syncs 100+ songs, when I only want to sync 1! I'm running Itunes 11.3.1.2

    After having experienced similar problems and having it back to work, I have a few suggestions:
    - Try to find out if the syncing stops at a particular track or song. That might - out of the blue - have gotten corrupted in one way or another. Since that song will not be on the iPod, iTunes will try over and over to put it on and crash in one way or another;
    - reformat the iPod as described in the iTunes 9 crash-thread. It takes time (at first it seems to do nothing, but that is because the green bar is moving with very small steps);
    HTH

  • Please Help on this

    Hi Experts,
        I have schema which has to be implemented in SAP BI 7.0.Schema contains one Fact Table & three Dimension tables.It is snowflake schema.
    Assume Fact table as F & Dimension  tables as D1,D2,D3.The Schema is as follows.
    F---->D1--->D2---->D3
    Now i have created navigation attribute from D1 to D2 & D2 to D3 Then i have created a infocube having  facts & D1 attribute.
    So when i drag the infoObject from D1 having navigation attributes to D2 & from D2 to D3 iam unable to get D3 information.
    Please can any one suggest me how to get D3 level of information in report Or how to accesss the facts & D3 level information .
    Please Help on this
    Thanks & Regards
    Sameer Khan

    Hi Sameer,
    Your question is not clear.
    Regards,
    Sagar

  • I was trying to set Adobe Reader 11 as default PDF viewer on my client PCs, Please help me this. My server is windows 2012 R2 and client PCs are Windows 8.1

    I was trying to set Adobe Reader 11 as default PDF viewer on my client PCs, Please help me this. My server is windows 2012 R2 and client PCs are Windows 8.1

    Hi Krisis,
    I have found a forum where similar query was answered. Hope this helps.
    http://www.loginvsi.com/forum/support-v4/857-adobe-reader-xi-not-set-as-default-pdf-viewer -in-server-2012-r2-rds
    Regards,
    Anoop

  • HT5312 i forgot my secret question, please help me this problem. Thanks

    I forgot my secret question, please help me this problem. Thanks

    Contact iTunes Customer Service and request assistance
    Use this Link  >  Apple  Support  iTunes Store  Contact
    And/or see the  More Like This  section on the right.

  • Trying to update photoshop and repeatedly get error code U44M1P7, can anyone please help resolve this?

    Trying to update photoshop and repeatedly get error code U44M1P7, can you please help resolve this?

    JJMack, Thanks for the info. Let this old man digest it and see if I can put the info into action. I'll give you a feedback. Thanks for your help in this matter. I am not a tech savvy person. 
    Rueben Rueben D. Olivas Home Ph:  1-671-969-2452
    Cell Ph:  1-671-747-2453La Luz Photography
    Email: [email protected]/Guam Firehouse Cook: http://guamfirehousecook.blogspot.com/BBQGuam: http://bbqguam.blogspot.com/My Photostream: http://ruebenolivas.megashot.net/photostream

  • Please help in this

    Hi
    Please help with this:
    How to know if string buffer doent contain anything:
    I am getting stringoutofbounds exception..
    StringBuffer myString=new StringBuffer(" ");
    if(myString.toString()!=" ")
         int i=myString.lastIndexOf(",");
         myString.deleteCharAt(i).toString());
         }

    If you want to compare the equivalence of two String datatypes, use the "equals()" method. The technique you are using, the equality operator '!=', will compare not the semantic value of the string representation, but rather the value of the object reference of that string. So in your example, ( myString.toString() != "" ) will always be true, even if the StringBuffer is instantiated with an empty string because the two sides of the operator refer to different objects.
    Use instead ..
    if ( !myString.toString().equals(""))

  • My Canon MP620 appears to be connected, yet every time I try to print something, it says error.  I have tried to unplug and track the error, but I cannot figure out why. Please help! this is such an inconvenience!

    My Canon MP620 appears to be connected, yet every time I try to print something, it says error.  I have tried to unplug and track the error, but I cannot figure out why. Please help! this is such an inconvenience!

    What Mac model? What Mac OS version?
    FYI, this forum is for Apple hardware made before 1999.

  • Hi. i updated my iphone 4s to iOS 7.0.4 but after that, wifi is not enabled. please help in this regard.

    Hi. i updated my iphone 4s to iOS 7.0.4 but after that, wifi is not enabled. please help in this regard.

    Apple has provided a useless workaround... [http://support.apple.com/kb/ts1559]
    Else the only option you have is to fight with the Apple Store "geniuses" to get a free replacement for out of warranty 4S devices. Or try a third party repair like iFixit. The wifi chip might cost you 60-80$ but it is better than paying Apple 200$.
    Overheating is the culprit in 4S devices. And its been getting worse with ever successive iOS 7 update. I think 7.0.4 was the final nail in the coffin.
    They are not getting my money anymore.. I've had iPhones every since they launched... but no more. Feels like a dead investment after facing this issue. I can never sell my iPhone 4S even if I want to. There have been cases where users just sold their 4S devices, the new owner updated to 7.0.4, wifi stopped working and the seller had to give a refund.
    I'm basically sitting on a 650$ white brick. Hmm... I wonder if white bricks sell higher than the standard red bricks
    Guess it's time for you to sign up this ongoing campaign [https://www.change.org/petitions/apple-to-get-apple-to-replace-all-units-affecte d-negatively-by-the-update-of-ios7-or-patch-an-update-that-will-remedy-the-issue s-many-loyal-customers-are-experiencing#share]
    TBH, I can't get a replacement because I am in India where 4S was never launched as an unlocked device and there are no Apple retail stores. Only resellers here like Vodafone/Reliance/Airtel. But if this petition can help the one who can take advantage of having retail stores around... why not? Sign up please. Thank You.

  • My iPhone 4 is going auto off and auto on. Could you please help on this please

    my iPhone 4 is going auto off and auto on. Could you please help on this please

    iOS 8.1.3 is the latest version. There's nothing to download.

Maybe you are looking for

  • I have two iPhoto Libraries now after restore.  Can I delete one?

    A couple of weeks ago I had a problem with iPhoto and used the restore feature.  Now I have two folders in my Pictures section of iMac.  One folder says iPhoto and the other folder says iPhoto (original).  They both had the same pictures in them exce

  • Can't accept outlook invites in iPhone calendar app

    Hi everyone, Here's my problem: I have been using my iPhone 4 for about a year now, syncing the calendar via MobileMe first and then via iCloud. All this time I haven't been able to accept calendar invites on my phone. The functionality on my phone i

  • Connecting new TV to Macbook:  which adapter do I need?

    I have a Macbook White Intel Core 2 Duo 2 Ghz. I am trying to connect it to my new Sanyo DP19640 TV to stream Netflix. I cannot seem to determine which adapter I need.

  • How we can find BAPI's for a transactions?

    hi how we can find BAPI's for a transactions? thanks in advance

  • Provider Not Found Erro

    At the final step of the SOAP/WSDL wizard I get "An unknown error has occurred" Under details I see: "Provider com.bea.xml.stream.MXParserFactory not found" Is this a missing class or plug in. Or is the WSDL somehow causing this. I searched the WSDL