How can i plot a histogram with using the results of Line Length

PLS HELP.How can i prepare a histogram with using the results of line length code(It is somewhere in the middle).
This is a final exam take-home question. I would appreciate if you can help?
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.swing.*;
import java.text.*;
import java.io.File;
public class WordAnalyser extends JFrame implements ActionListener
private JMenuItem jmiAc, jmiSil, jmiCikis, jmiAnaliz, jmiHakkinda, jmiKullanim;
private JTextArea jta1, jta2;
private JFileChooser jFileChooser = new JFileChooser();
File hafizada;
File aktarilan = new File("Sonuc.txt");
// Main method
public static void main(String[] args)
WordAnalyser frame = new WordAnalyser(); /* Ana ekran olusturulur */
frame.setSize(400, 300); /* Degerleri belirlenir */
frame.setVisible(true); /* Gorunebilirligi ayarlanir */
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
public WordAnalyser()
setTitle("Serkan Ozgen Dosya Inceleme Programina Hos Geldiniz");
JMenuBar mb = new JMenuBar();
setJMenuBar(mb);
JMenu fileMenu = new JMenu("Dosya");
fileMenu.setMnemonic('F');
mb.add(fileMenu);
JMenu helpMenu = new JMenu("Degerlendirme");
helpMenu.setMnemonic('H');
mb.add(helpMenu);
JMenu kullanimMenu = new JMenu("Kullanim Kilavuzu");
mb.add(kullanimMenu);     
fileMenu.add(jmiAc = new JMenuItem("Ac", 'A'));
fileMenu.add(jmiSil = new JMenuItem("Sil", 'S'));
fileMenu.add(jmiCikis = new JMenuItem("Cikis", 'C'));
helpMenu.add(jmiAnaliz = new JMenuItem("Analiz", 'D'));
helpMenu.add(jmiHakkinda = new JMenuItem("Hakkinda", 'H'));
kullanimMenu.add(jmiKullanim = new JMenuItem("Kullanim"));     
getContentPane().add(new JScrollPane(jta1 = new JTextArea()), BorderLayout.CENTER);
getContentPane().add(jta2 = new JTextArea(), BorderLayout.SOUTH);
jmiAc.addActionListener(this);
jmiSil.addActionListener(this);
jmiCikis.addActionListener(this);
jmiAnaliz.addActionListener(this);
jmiHakkinda.addActionListener(this);
jmiKullanim.addActionListener(this);
public void actionPerformed(ActionEvent e)
String actionCommand = e.getActionCommand();
if (e.getSource() instanceof JMenuItem)
if ("Ac".equals(actionCommand))
Ac();
else if ("Sil".equals(actionCommand))
Sil();
else if ("Cikis".equals(actionCommand))
System.exit(0);
else if ("Analiz".equals(actionCommand))
sayim();
else if ("Hakkinda".equals(actionCommand))
JOptionPane.showMessageDialog(this,
"!!!! Bu program text analizi gerceklestirir. Her hakki saklidir SERKAN OZGEN!!!!",
"Bu program hakkinda",
JOptionPane.INFORMATION_MESSAGE);
else if ("Kullanim".equals(actionCommand))
     JOptionPane.showMessageDialog(this,
     " Ilk once dosya menusunden Ac i tiklayarak analiz etmek istediginiz Dosyayi seciniz (Lutfen uzantisi *.txt \nveya *.log olsun). Daha sonra Degerlendirme menusunden analizi tiklarsaniz dosyanizda kac adet rakam, harf, \ncumle ve kelime oldugunu gorebilirsiniz. Simdiden kolay gelsin",
     "Programin kullanim detaylari",
     JOptionPane.INFORMATION_MESSAGE);
private void Ac()
if (jFileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
hafizada = jFileChooser.getSelectedFile();
Ac(hafizada);
// Acilan Dosyayi ana ekranda gostermeye yariyan bir method
private void Ac(File file)
try
// Acilan dosyayi okuma ve ana ekranda gosterme
BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
byte[] b = new byte[in.available()];
in.read(b, 0, b.length);
jta1.append(new String(b, 0, b.length));
in.close();
catch (IOException ex)
// Temizle tusunun hangi ekranlara etki edecegini secme
private void Sil()
jta1.setText("");
jta2.setText("");
private void sayim()
int buff;
int sayac = 0;
int Cumleler = 0;
int Kelimeler = 0;
int Karakterler = 0;
int Satirlar = 0;
int Rakamlar = 0;     
boolean start = true;
int linenum = 0;     
try
FileInputStream instream = new FileInputStream(hafizada);
FileOutputStream outstream = new FileOutputStream(aktarilan);
     BufferedReader infile = new BufferedReader(new InputStreamReader(new FileInputStream(hafizada)));
PrintStream out = new PrintStream(outstream);
     out.println("---Kelime Avcisinin Sonuclari---");
     String line = infile.readLine();
     while (line != null){
     int len = line.length();
     linenum++;
     line = infile.readLine();
     out.println("Line Length :"     + linenum + "\t" +len);
while ((buff=instream.read()) != -1)
switch((char)buff)
case '?': case '.': case '!': /* Eger "?", "." veya "!" gorurse program cumleleri ve kelimeleri arttirir*/
if (start == false)
Cumleler++;
Kelimeler++;
start = true;
break;
case ' ': case '\t': case ',': case ';': case ':': case'\"': case'\'': /* Eger /t,;:\ ve \" bu isarteleri goruruse program kelimeleri arttirir */
if (start == false)
Kelimeler++;
start = true;
break;
          case 'n': case '\n': /* Eger \n gorurse satirlari arttirir */
          if (start == false)
               Satirlar++;
               Kelimeler++;
               start = true;
          break;
default:
if (((char)buff >= 'a' && (char)buff<='z')|| /*a-z, A-Z veya - degerlerini gorurse karakterler arttirilir */
((char)buff >= 'A' && (char)buff<='Z')||
((char)buff == '-'))
Karakterler++;
if ((Kelimeler % 50) == 49)
if (start == true)
               out.println();     
out.print((Kelimeler+1) + " ");
out.print((char)buff);
start = false;
          if ((char)buff >='0' && (char)buff <='9') {  /* 0-9 gorurse rakamlari arttiri */
               Rakamlar++; }
}// switch
     }//while
instream.close();
out.println();
out.println();
out.println("Karakter sayisi: " + Karakterler);
     out.println("Kelime sayisi: " + Kelimeler);
out.println("Cumle sayisi: " + Cumleler);
     out.println("Satir sayisi: "+ Satirlar);
     out.println("Rakam sayisi: "+ Rakamlar);
outstream.close();
try
BufferedInputStream in = new BufferedInputStream(new FileInputStream(aktarilan));
byte[] b = new byte[in.available()];
in.read(b, 0, b.length);
jta2.append(new String(b, 0, b.length));
in.close();
catch (IOException ex)
catch (Exception e)
System.out.println(e);
}

Why is it that you're not interested in IOExceptions?
catch (IOException ex)
} Empty catch blocks is a hallmark of foolish Java code. At least print out the stack trace.
%

Similar Messages

  • How can i create multiple accounts but use the same itunes?

    how can i create multiple accounts but use the same itunes?

    Hi iCloud is Making Me Go Crazy,
    You will need to create a new Apple ID for your GameCenter and iCloud services.  You can continue to use the current Apple ID you share with your Mom for access to iTunes Store purchases if you wish. 
    Using your Apple ID for Apple services
    http://support.apple.com/kb/HT4895
    Frequently asked questions about Apple ID
    http://support.apple.com/kb/HT5622
    Cheers,
    - Judy

  • I want to download an audiobook, but my daughter has a giftcard credit on the account. How can I download my audiobook without using the money from her giftcard?

    I want to download an audiobook, but my daughter has a gift card on the account.  How can I download my audiobook without using the money from her gift card?

    go directly to your ibook app. and you're going to find it. it's only with ibooks app.
    best
    Olivier
    <Edited by Host>

  • How can I connect personal hotspot to use the internet from my phone on my laptop?

    I do not have internet at home and want to be able to connect using the personal hotspot on my phone. How do i do this??

    How much would be a month?
           From: Verizon Wireless Customer Support <[email protected]>
    To: kelly johnson <[email protected]>
    Sent: Wednesday, October 8, 2014 12:02 PM
    Subject:  - How can I connect personal hotspot to use the internet from my phone on my laptop?
    #yiv3595356488 img
    |  
    |
      | 
    A message from the Verizon Wireless Community
      |
    |   |
    How can I connect personal hotspot to use the internet from my phone on my laptop?
    created by Verizon Wireless Customer Support in iPhone 4S - View the full discussion                  Hello kmj65
    Thanks for replying. The plan you have it would be an additional charge to add the hotspot feature. It's not free with the Nationwide plan. You would need to add the feature online at www.verizonwireless.com/myverizon
    JoeL_VZW
    Follow us on Twitter @VZWSupport   Reply to this message by replying to this email -or- go to the message on Verizon Wireless Community Start a new discussion in iPhone 4S by email or at Verizon Wireless Community


    © 2014 Verizon Wireless
    Verizon Wireless
    One Verizon Way
    Mail Code: 180WVB
    Basking Ridge, NJ 07920
    Not interested in these emails anymore, or want to change how often they come? Update your email preferences by visiting https://community.verizonwireless.com/user-preferences!input.jspa.
      |
    We respect your privacy. Please review our privacy policy for more information
    about click activity with Verizon Wireless and links included in this email.
      |

    |

  • In iPhoto, how can I find a particular event using the search function?, In iPhoto, how can I find a particular event using the search function?

    In iPhoto, how can I find a particular event using the search function?

    NO - read my last answer over a year ago
    That is because iPhoto is all about photos - not about files
    You do not access the piles in iphoto - you access the photos using either iPhoto or the media browser - see this user tip for photo access details
    LN

  • Updating PS CC 2014--how can I tell if I am using the latest version?

    I just updated Bridge, PS and LR from the Creative Cloud, but when I went to use them, I was still using the old versions despite the fact that CC said I had updated to the latest versions.  A thread in the LR forum led me to sign out and back into Creative Cloud, and that did the trick for LR.  However, I cannot discern any changes in PS.  How can I tell if I am using the latest version of PS?  When I click on About Photoshop, the popup says:
    TIA.

    that's the latest ps as of today.

  • How can I locate my ipad with only the serial number

    how can i locate my ipad with only the serial number

    you can't
    even with the IMEI number the police need a warrent to get such info from the carriers

  • How can I save a page with all the links for offline reading

    how can I save a page with all the links for offline reading

    Maybe '''Pocket''' is what you want?
    [https://addons.mozilla.org/en-US/firefox/addon/read-it-later/?src=search Pocket (Mozilla Addons)]

  • How can I plot Data in StripChart using ActiveX in LW/CVI

    I have a DAQ with multichannel, I use an external synchronisation and I like to display my Data in RT using CWGraphChart. When I use PlotChartXY I can only plot the width my graph and then it stop (no stripchart possible!!!). But when I make the same with PlotChartY without my external synchronisation, the STRIPCHART works but I have a problem with synchronisation�I hope you understand what I mean. If somebody can help me or send me an example using stripchart with ActiveX, I will be very thank.
    Alex

    duplicate post, answer here
    Bilal Durrani
    NI
    Bilal Durrani
    NI

  • How can i zip a folder with use of  webutil

    hi,
    We are using forms 10g and weutil 1.0.6.Is it possilble to zip and extract a folder with use of the webutil
    our requirement is take current day folder, zip that filder and upload that file
    second requirement is extract the uploaded zip file
    if anybody know thanks in advance
    mathew

    most of the zip-tools can be started via parameter. So you have to read the readme's of those tools and start it in the background with the appropriate parameters

  • How can I back up project with just the used part of the clips?

    Hello all... I have a FCPX project that I would like to back up.
    Duplicate project is copying all of the event and all of the original clips...
    In my case the original clips are 1-2 hour interviews... I use about 2-3 minutes of about 30 of them...
    Back up is ridiculous...
    I'm looking for more of a media manager type of back up where it just backs up the clips from the timeline and gives me maybe  a bit of a handle on each clip...
    Make sense?
    I hope so... cause I've spent about 3 days trying to get this project on an external drive...
    Not very successful so far...
    SOS
    Thanks!

    I'm fairly sure Apple assumes most people want to keep their original footage... "forever." Media management in FCPX has received quite a lot of praise from professionals.
    Everything comes down to prep and organization.
    Projects are just pointers into media clips and render files.  If you want to trim down your projects, go to the File menu and select Delete Project Render Files...
    Deleting Event clips will kill a project no matter what. Archiving a project without the associated Event media is pointless. Best advice is to always keep your original media. That way you can reconstruct an Event later for the clips your project requires. As far as I know, there is no way to  delete (to the trash) Event clip ranges.
    If you know that you won't be using 90% of your footage and want to delete the extraneous original footage, I would recommend using Quicktime 7 Pro and selecting the ranges you think you'll need beforehand. This is easily accomplished by opening your original clips, setting an In and Out point (just like in FCPX) -- select Copy, then File > New and Paste. Save as a Self-Contained clip and import it into FCPX. QT7Pro does not alter the original footage (as much as possible, I imagine it has to occasionally build an intitial i-frame if your original is something like H.264, but other than that, you can't tell the difference.)
    To preserve a project entirely, you will  need to back up the associated Event clips as well. Those are the clips you need to worry about trimming. You should use Copy files to Final Cut Events folder on Import. You should be able to delete any transcoded media (High Quality and/or Proxy) before archiving (don't take my word as an absolute on that -- Tom probably knows for sure.) For simplicity, you should create an Event for JUST the clips you will be using for the project to backed up. That way, at the end, you can group the Event folder and the Project together for archiving (and with the smallest footprint).
    You could also simply Export your (trimmed) project as H.264 (FCPX uses the highest quality settings) without titles, effects, generators or transitions to retain the portions of clips you want to save/archive and delete all the original media — and forego everything stated above. You will still have an exceptional quality source for any subsequent projects using the same material and it would be compact enough. I wouldn't archive with ProRes (except maybe Proxy... it's about the same bitrate as the H.264 generated, except I think the H.264 would still be a better choice.) Using ProRes kind of defeats the purpose of archiving.

  • How can I make multiple quizzes with their own results slides within one project of Captivate 7?

    In one Captivate 7 project I want to create multiple quizzes with their own results slide. 
    Currently I have 5 quizzes that all are linked to 1 results slide.
    Is there a way to give each set of questions their own results slide?
    (I saw a response to a similar question for Captivate 5 from 2012, but I couldn't get much use out of is and I figured there was an easier way in Captivate 7).
    Any help would be appreciated!
    Thanks!

    Thanks for the reply Lilybiri!
    I checked out the link and it's useful, however your other plan might work better for me:
    Either you link to separate CP-files that have each their quiz, or you can show intermediate results slides (see link below), but you have to know that the score that will be transmitted to a LMS is the total score of all the quizzes.
    But how exactly do I link separate CP-files?  Do I have to publish them first and then link them, or can I link them before I publish?
    If you could shoot me a link or some advice I'd greatly appreciate it.  I'm finishing up a huge project that is due at the end of the day and this quiz issue is one of the last things keeping me from being finished.
    Thanks!

  • How can you find your password to use the App Store on an iPhone?

    My friend has forgotten her password for the App Store.
    Her account is her email address.
    How can she either get her password or create a new one in order to use the App Store?

    I think I tried this last night but will attempt it again.
    I was tired after talking with an AT&T technical representative about a voicemail issue.
    I hope her voicemail is still accessible today.
    I asked the AT&T person to remove the voicemail password.

  • How can I save VI's with all the subvi's.

    Dear Sir or Madam,
    I wrote a vi that I want to share with another person. I have sent the
    vi to my friend and he told me that he received it, but he need the
    SUBVI'S.
    I have many subvi's in the main vi including some commercial libraries.
    Therefore I want to be sure that the next time all the subvi's will be
    send with the main vi. How can I do this??? This is my question.
    I was playing around the saving options, but I am not comfortable with
    the results.I am using LABVIEW 6i.
    Many, many thanks for your patience and any help( I am a non-expert in
    programming).
    Luis Díaz
    [email protected]

    Select Save with Options>Development Distribution. You'll be prompted for the name of a .llb to save all of the VIs in. You can refer to the on-line help or the LabVIEW User Manual for more information.

  • How can I find which applications are using the most power?

    I have recently noticed a full charge of power doesn't last as long as it used to on my iPad 2.  Is there some way to determine which applications are using the most power?
    I have been monitoring my home network router accesses and have noticed the iPad logs accesses every 15 seconds.  This only happened recently.  It had been well behaved and only accessing once or twice a day before.  I installed the most recent iTunes upgrade, per suggestions during a Sync.  The problems seemed to occur after this update.  I have gone through all the settings and have minimized the applications requiring higher power (I switch off the location services unless I'm away from home.  Likewise, I turn off my cellular carrier unless I'm away from home, etc.)
    In short, how can I maximize my power usage (aside from turning it off)?
    Thanks.
    Dave

    Thanks for responding so quickly.
    I'm really trying to find out why the battery is depleting much faster than it used to all of a sudden.  I used to be able to put a full charge on it and it would last about 5 to 6 days with normal use (normal for me).  Now that battery only lasts about 2 to 3 days with the same use.
    I DO recharge it when it needs to be charged but this is indicating there is something else (new) that is causing the power drain.

Maybe you are looking for

  • Document Attachment in DMS

    Hi Experts, I need your valuable inputs on below query : I have developed a z program wherein i have given a field which requires a document no to be filled which has to be validated with my existing document entered in table (DRAW) through transacti

  • Encrypt and Decrypt files using PGP and GPG

    Dear members, We have a customer that need to process files received through sFTP, FTPs and FTP over SSL encrypted with PGP and GPG methods. We Know that those encryption Method are not supported out of the box in Oracle SOA Suite and WCC but We need

  • How to organize in iPhoto 6???

    I need help organizing my pictures in iPhoto 6... When I need to send a picture or just browse in my directory of pictures I have to take a guess in which folder the picture i'm looking for is in. For example I have a "Modified" and "Originals" folde

  • Support package is different ,can we tranport objects ?

    Hi, Experts, I have developed some objects,,Now i need to transport the m from BW DEV to BW Production. But the support package of our                            DEV system is :SAPKW70022                           Prod system is : SAPKW70014 1) So, w

  • Edit and update multiple records in JSP buisness components

    Hi everybody, I'm building BC4J components using entities and views and JSP buisness components. how can I edit and update multiple records at a time in the jsp file Note using the databean "oracle.jbo.html.databeans.EditCurrentRecord" one can view o