Can any one help me to solve my prblem

exception java.io.IOException is never thrown in body of corresponding try statement
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.*;
import java.util.Date;
import java.io.*;
public class SampleIO2
int[] u= new int[27];
    JFrame f;
    String s1,s2;
    int v1,v2,v3,v4;double v5;
     JButton b1,b2,b3;      
    JTextField []a=new JTextField[27];
    int []p=new int[27];
  JTextField t1,t2,t3,t4,t5,t6,t7,t8;
  JLabel l1,l2;
    public SampleIO2()
        initializeFrame();
        initializeComponents();
        setButtonAction();
        f.show();
    public void initializeFrame()
        f = new JFrame("Kandil Softwares");
        f.setBounds(300,250,700,400);
        f.getContentPane().setLayout(null);
        f.setResizable(false);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.getContentPane().setBackground(Color.GRAY);
    public void initializeComponents()
         Date currentDate = new Date();
         l1= new JLabel("Name                                                                             Salery ");
         l1.setBounds(10,5,385,20);
         f.getContentPane().add(l1);
              l2= new JLabel("Over Time :                   Ins :                      Salf :                       Total :");
         l2.setBounds(5,180,385,20);
         f.getContentPane().add(l2);
          t1 = new JTextField();//total
        t1.setBounds(350,180,100,20);
        f.getContentPane().add(t1);
          t2 = new JTextField();//name
        t2.setBounds(20,30,80,20);
        f.getContentPane().add(t2);
        t3 = new JTextField();//over time
        t3.setBounds(70,180,45,20);
        f.getContentPane().add(t3);
        t4 = new JTextField();//salery
        t4.setBounds(280,30,50,20);
        f.getContentPane().add(t4);
        b1 = new JButton("Cal");
        b1.setBounds(20,300,90,40);
        f.getContentPane().add(b1);
        b2 = new JButton("Save");
        b2.setBounds(130,300,90,40);
        f.getContentPane().add(b2);
        b3 = new JButton("New");
        b3.setBounds(240,300,90,40);
        f.getContentPane().add(b3);
         t5 = new JTextField();//ins
        t5.setBounds(150,180,50,20);
        f.getContentPane().add(t5);
         t6 = new JTextField();//salf
        t6.setBounds(250,180,50,20);
        f.getContentPane().add(t6);
          t7 = new JTextField();
        t7.setBounds(20,225,50,20);
        f.getContentPane().add(t7);
         t8 = new JTextField();
        t8.setBounds(20,250,50,20);
        f.getContentPane().add(t8);
        t1.setEditable(false);
       // f.getContentPane().setBackground(Color.blue);
         int q=60;
         int s=60;
         for(int i=0;i<27;i++){
         a=new JTextField();
          a[i].setBounds(q,s,35,20);
          f.getContentPane().add(a[i]);
          q=q+40;
          if ((i==6)||(i==13)||(i==20)){
          q=60;
     s=s+30;}
public void setButtonAction()
b1.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent e)
     //double[] p = new double[27];
// String[] n = new String[2];
     if (t3.getText().length()==0)
          v5=0;
          else
     v5=Integer.parseInt(t3.getText());
     if (t4.getText().length()==0)
          v2=0;
          else
     v2=Integer.parseInt(t4.getText());
     if (t5.getText().length()==0)
          v3=0;
          else
     v3=Integer.parseInt(t6.getText());
     if (t6.getText().length()==0)
          v4=0;
          else
     v4=Integer.parseInt(t6.getText());
     double disc1=0,disc2=0,disc3=0;
     double late1=0,late2=0,late3=0;
double rus =0;
int x=0,y=0,z=0;
     double sum = 0;
     double sal = v2;
     double hafez =sal*0.05;
     double dsal = sal/30;
for (int i=0 ;i<a.length;i++){
s1 = a[i].getText();
if(s1.length()==0)
     v1=0;
     else if(s1.charAt(0)=='a'){
          x++;}
else if(s1.charAt(0)=='b'){
          y++;}
     else if(s1.charAt(0)=='c'){
          z++;}
     else
     {v1=Integer.parseInt(a[i].getText());}
     int c=0;v1=p[i];     
     double minsal = sal /( 30 * 9 * 60) ;
double latemin = v1;
if (latemin ==0)
     c++;
if ( latemin > 60 )
     late1 = latemin - 60;
     late2 = 30;
     late3 = 30;
else if ( latemin > 30 )
     late1 = 0;
     late2 = latemin - 30;
     late3 = 30 ;
else if (latemin <= 30)
     late1 = 0;
     late2 = 0;
     late3 = latemin;
disc1 = late1 * 3 * minsal;
disc2 = late2 * 2 * minsal;
disc3 = late3 * 1.5 * minsal;
sum = disc1 + disc2 + disc3;
rus = rus + sum;
double ove=v5*1.5*(sal/(30*9));
double c1 = x*1.5*dsal;
     double c2 = y*2*dsal;
     double c3 = z*3*dsal;
     double cs=c1+c2+c3;
double fsalery = sal+ove - (rus+cs+v3+v4);
t1.setText(""+fsalery+" ");
String w1=t2.getText();String w2=t7.getText();
// save(p,w1,w2,v3,v1,v4,v5,fsalery);
b2.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent e)
b3.addActionListener(new ActionListener()
     public void actionPerformed(ActionEvent e)
public static void save(int[] q,String n,String c,int in,int sal,int salf,double over ,double total)throws IOException
     DataOutputStream out = new DataOutputStream(new FileOutputStream("asd.txt"));
try{
int f=0;
}catch(IOException ioe){
ioe.printStackTrace();
for(int i = 0; i < q.length; i ++) {
out.writeInt(q[i]);
out.writeChar('\t');
     out.close();
public static void main(String[] args)
     JFrame f = new JFrame("Hello, World!");
     int y=1;
     /*JLabel myLabel = new JLabel("Hello, World!");
myLabel.setBounds(244, 240, 80, 40);
f.getContentPane().add(myLabel);
f.show();
SampleIO2 g = new SampleIO2();

public static void save(int[] q,String n,String c,int in,int sal,int salf,double over ,double total)throws IOException
         DataOutputStream out = new DataOutputStream(new FileOutputStream("asd.txt"));
       try{
                                                                 int f=0;
}catch(IOException ioe){
        ioe.printStackTrace();
        for(int i = 0; i < q.length; i ++) {
            out.writeInt(q);
out.writeChar('\t');
     out.close();
This section?
Nothing will get thrown because your code that would throw an exception is not in the try. You want to do something like this maybe...
public static void save(int[] q,String n,String c,int in,int sal,int salf,double over ,double total)throws IOException
       DataOutputStream out = null;
       try{
          out = new DataOutputStream (new FileOutputStream ("asd.txt"));
          int f=0;
          for(int i = 0; i < q.length; i ++) {
            out.writeInt(q);
out.writeChar('\t');
     out.close();
}catch(IOException ioe){
ioe.printStackTrace();
if (out != null) { out.close(); }
// note: your declaration has a throws IOException, which means you
// don't need this try catch block here. If you wanted to contain it and add your
// own error message, this would be fine, and you say something along the
// lines of throw new IOException ("An Error Occured"); in the catch section.
//Then your throws IOException in your declaration would make sense. So
// either take out the try catch block, and if an exception is thrown, the calling
// method would have to catch it, keep it to contain it and throw your own error // message or keep it and contain it but take out the throws IOException from // your declaration

Similar Messages

  • Hello guys..!! I have got my new  iphone 4 2 days ago.The same day it got a problem of auto restart in every 1, to 2 minutes. I updated and restored it many times...but of no use... can any one help me how to solve this problem..!!

    Hello guys..!! I have got my new  iphone 4 2 days ago.The same day it got a problem of auto restart in every 1, to 2 minutes. I updated and restored it many times...but of no use... can any one help me how to solve this problem..!!

    Go to Settings/General/Reset - Erase all content and settings. the connecto to iTunes and restore as a New phone. Do not restore any backup. If the problem persists you have a hardware problem. Take it to Apple for exchange.
    This assumes that the phone is not hacked or jailbroken. If it is you will have to go elsewhere on the internet for help.

  • Have just down loaded Yosemite over Mountain Lion, Indesign CS5 does not work ( Am dependant on it) although Bridge , Light Room and Elements operate OK How do I solve this rapidly. Can any one help on this issue. Thanks

    Have just down loaded Yosemite over Mountain Lion, Indesign CS5 does not work ( Am dependant on it) although Bridge , Light Room and Elements operate OK How do I solve this rapidly. Can any one help on this issue. Thanks

    Sorry to say it, but I think you can see from Bob's response that there's no way to solve this rapidly.
    Did you take an image of your Mountain Lion install before upgrading to Yosemite? Roll back to that. If you're not in the habit of taking a snapshot of your system before performing operating system upgrades - get in that habit. If you are dependent on anything at all on hour computer, having a reliable backup method in place is essential. If you don't have a Time Capsule, or some other way to run Time Machine onto a disk that's not in your computer, go set that up yesterday.
    If you can't just remove Yosemite and roll back to Mountain Lion for whatever reason, you can partition your drive so that you can install both Yosemite and Mountain Lion on the same drive, and then boot into Mountain Lion when you need to work in CS5. Or you can take your Mountain Lion disc (I assume you have one, no?) and then use it to create a virtual machine in something like VirtualBox to run Mountain Lion from inside Yosemite.

  • TS1630 My Iphone 4s reciever is not working properly, when i call someone from my iphone 4s.  can any one help me how to solve this problem?

    My Iphone 4s reciever is not working properly, when i call someone from my iphone 4s.  can any one help me how to solve this problem?

    You might like to define "not working properly".

  • I'm not able to copy and paste files from my mac to hard disk and usb. I have tried dragging the items to those devices but it won't work. I also have tried copying and pasting those files onto those devices but that doesn't work too. Can any one help?

    I'm not able to copy and paste files from my mac to hard disk and usb. I have tried dragging the items I want to copy to those devices but it won't work. I also have tried copying and pasting those files onto those devices too but that doesn't work too. Can any one help?

    Hi BobRz
    Thanks for you suggestion but it didn't work - are there other ways for solving this problem? Or is it because my files that I want to copy and paste onto my hard disk etc are too big? (However there is space on my hard disk and it works on a PC)

  • Hey, I had met a problem with installation. Can any one help me?

    Hi everyone, I'm an user of Windows 7(64 bit),
    I had just download "Master Collection CS5.5"
    Everything are fine but Adobe Acrobat Professional can't install on my computer.
    There are the details..:
    Exit Code: 6
    -------------------------------------- Summary --------------------------------------
    - 0 fatal error(s), 4 error(s), 1 warning(s)
    WARNING: DW066: OS requirements not met for {AC76BA86-1033-F400-7760-000000000005}
    ----------- Payload: {AC76BA86-1033-F400-7760-000000000005} Acrobat Professional 10.0.0.0 -----------
    ERROR: Error 1324.The path R嶰up廨er un document num廨is?sur un multifonction.sequ or the volume is invalid. Please enter it again.
    ERROR: Install MSI payload failed with error: 1603 - 安裝時發生嚴重錯誤。
    MSI Error message: Error 1324.The path R嶰up廨er un document num廨is?sur un multifonction.sequ or the volume is invalid. Please enter it again.
    ERROR: DW050: The following payload errors were found during install:
    ERROR: DW050:  - Acrobat Professional: Install failed
    Thanks

    Re: Hey, I had met a problem with installation. Can any one help me?
    This worked for an English version and the concept should work with all Adobe programs - new or old (hopefully in any language). My guess is that you have/had an older version of Acrobat/Reader on your computer hard drive that needs to be *completely* removed first. Uninstall the new (and any old) Acrobat; then try using the "kb2..." guideline link below before reinstalling the new Acrobat. I am including the lengthy instructions in order to help others with more extensive installation problems. Good luck!
    I live on a fixed income and use CS for a hobby. I had problem installing Adobe Creative Suite (CS1) to Windows 7 64-bit Pro on my new computer. Also installed Adobe Photoshop LR3. What I learned: All Adobe products (Flash, Acrobat/Reader, Photoshop, Creative Suites, etc.) leave a VERY pervasive footprint on your hard drive. Logic finally worked for me.... think of building a house; there is an order you have to do things in. First, you have to clean the area before laying the foundation; then you have to build the framework before you put the roof on. You cannot install an older program over ANY newer program; and you will sometimes have a problem installing a newer program containing Flash, Reader, etc. unless you "erase" the older versions of Flash, Reader beforehand. If installing older programs, do a Custom/Manual install; do not install older versions of Flash, Reader, etc.  packaged with your Adobe software.
    SOLUTION (not easy, but it works):
    I first tried this; it did not solve my problem (but, if applicable, may help others).  http://windows.microsoft.com/en-us/windows7/Make-older-programs-run-in-this-version-of-Win dows
    Before doing anything, make document and any database/presets/cache back-ups beforehand (keep notes on their designated location*); manually create a System Restore point. (Be prepared to reinstall Windows if necessary - I didn't have to.)
    Completely and meticulously eradicate (clean) your hard drive of ALL Adobe programs [uninstall, remove remaining folders, and remove only the registry entries that have the Adobe name attached (unless you are an expert and fully understand the other entries)]. Use this as a guideline  http://kb2.adobe.com/cps/400/kb400769.html
    Do a Custom/Manual reinstall of all your Adobe products *in order of release dates* (OLDEST first).... do not include Reader, Flash, etc. If your CD will not automatically run at this point, click "Open folder to view files" (use Computer/Windows Explorer, if necessary). Click "Adobe Creative Suite (or your desired program) ==> Setup.exe" (IMPORTANT: Make sure that Reader, Flash, etc. are unchecked.)
    After each of your desired Adobe programs are installed, test to insure they boot up. Then download the latest Reader, Flash, etc. apps and install them (I did this in order of release date - oldest first). Do test boot(s) again.
    Copy/Paste your document and any database/presets/cache back-ups into the appropriate folders (*this will vary depending on your programs and your filing system).
    It has been four weeks and all my Adobe programs work flawlessly - system is stable, no problems!

  • I have a ipod touch 3rd generation, I cant seem to get it connected to the internet, it connects to the router but not the internet ?? can any one help please?

    i recently got an ipod touch 3rd generation, i cannot seem to get it connected to the internet... it connects to the router but cannot seem to get connected to the internet, it seems to connect to the router for a very short while and then suddenly disconnect again, i have tried various solutions but cant seem to solve it, this seems to be a common problem as i have seen many complaints on other forums, many say it may be the dns server . please can any one help?

    Tap Settings / General / Reset / Reset Network Settings.
    See if that helps.
    If not try the iPod touch - Wi-Fi Troubleshooting Assistant.

  • Can any one help me in fi/sl extraction

    can any one help me in fi/sl extraction.i am not able to get data in cube please send me screen cut of fi/sl extraction.
    Edited by: chaitanya pissay on Apr 11, 2008 7:26 AM

    Hi Chaitanya,
    Check here........
    FI-SL Extraction
    FI /SL extraction
    http://help.sap.com/saphelp_nw70/helpdata/EN/04/e04c40cc538437e10000000a155106/frameset.htm
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/FISL/FISL.pdf
    Fi_SL data model
    http://help.sap.com/saphelp_bw32/helpdata/en/af/16533bbb15b762e10000000a114084/frameset.htm
    Regards,
    Vijay.

  • Can any one help me in this code

    Hi all,
    I have created a selection screen and my aim is to display some fields or some block dynamically by choosing some radio button is it possible.
    can any one help me in this.
    REPORT  z_g_test.
    TABLES: spfli,sbook,sscrfields.
    SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS:s_carrid FOR spfli-carrid.
    SELECTION-SCREEN END OF BLOCK 1.
    PARAMETERS:rad1 RADIOBUTTON GROUP g1 USER-COMMAND us1,
               rad2 RADIOBUTTON GROUP g1 DEFAULT 'X' .
    SELECTION-SCREEN BEGIN OF SCREEN 001 as subscreen ."WITH FRAME TITLE text-002.
    SELECT-OPTIONS: s_fldate FOR sbook-fldate.
    SELECTION-SCREEN END OF SCREEN 001.
    DATA ok_code LIKE sy-ucomm.
    INITIALIZATION.
    START-OF-SELECTION.
      SELECT * FROM spfli WHERE carrid IN s_carrid.
      ENDSELECT.
    END-OF-SELECTION.
      WRITE:spfli-carrid.
    AT SELECTION-SCREEN.
      CASE sscrfields-ucomm.
          WHEN'US1'.
    *      call screen 001 starting at 55 40.
      ENDCASE.
    Is i am going on the right way
    Regards,
    Lisa.
    Message was edited by: Lisa Roy
    Message was edited by: Lisa Roy
    Message was edited by: Lisa Roy

    This is what I meant. Copy this and try as it is and see if it serves your purpose.
    REPORT ztest1 .
    TABLES: spfli, sscrfields, sbook.
    SELECTION-SCREEN BEGIN OF TABBED BLOCK tabb1 FOR 4 LINES.
    SELECTION-SCREEN TAB (25) tabs1 USER-COMMAND ucomm1
                         DEFAULT SCREEN 001.
    SELECTION-SCREEN TAB (25) tabs2 USER-COMMAND ucomm2
                         DEFAULT SCREEN 002.
    SELECTION-SCREEN END OF BLOCK tabb1.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE abc.
    PARAMETERS: p_date LIKE sy-datum.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF SCREEN 001 AS SUBSCREEN .
    SELECT-OPTIONS: s_fldate FOR sbook-fldate.
    SELECTION-SCREEN END OF SCREEN 001.
    SELECTION-SCREEN BEGIN OF SCREEN 002 AS SUBSCREEN .
    SELECT-OPTIONS:s_carrid FOR spfli-carrid.
    SELECTION-SCREEN END OF SCREEN 002.
    INITIALIZATION.
      tabs1 = 'Search by flight date'.
      tabs2 = 'Search by flight number'.
      abc   = 'Some other parameters'.
    AT SELECTION-SCREEN OUTPUT.
      CASE sscrfields-ucomm.
        WHEN 'UCOMM1'.
          tabb1-prog = sy-repid.
          tabb1-dynnr   = 001.
          tabb1-activetab = 'TABS1'.
        WHEN 'UCOMM2'.
          tabb1-prog = sy-repid.
          tabb1-dynnr   = 002.
          tabb1-activetab = 'TABS2'.
      ENDCASE.

  • Can any one help me to code a browser

    hi ,
    I am Anil, I am doing an application in java. it needs a browser as IE or Morzilla . i tried to implement the browser using jdic.
    i add jdic.jar files as a external jar file and added it to my project. when i run the program in eclipse it works fine. when i want to create a jar file to my application it shows the follwing error..
    when i click on that jar file , it shows a Java Virtual Machine Launcher dialog box and in that dialog box it shows error Could not Find the main class. Program will exit ..
    this is the error.
    can any one help me to over come the error or any alternative method to implement a browser..

    DarrylBurke wrote:
    Corss poster!
    [http://www.java-forums.org/advanced-java/30298-how-write-job-aggregator-java-j2ee.html]
    dbNot anymore, Fubarable has axed that thread.

  • Hello, every one. Over the last few days I haven't been able to download any app from the app store. can any one help me, please?

    Over the last few days I haven't been able to download any app. can any one help me, please ? thank you.

    Andrea...
    You posted in the "Using Mac App Store" forum but your profile indicates you are using an iPad so that's what I'll try helping you with.
    On the iPad tap Settings > General > Reset > Reset Network Settings
    Then restart the iPad.  Hold the On/Off Sleep/Wake button down until the red slider appears. Slide your finger across the slider to turn off iPhone. To turn iPhone back on, press and hold the On/Off Sleep/Wake button until the Apple logo appears.
    If you still can't download apps, the problem may be your Wi-Fi connection >  iOS: Troubleshooting Wi-Fi networks and connections

  • HT1338 When I connect my Macbook Pro to my Dell DLP projector, either via cable or wirelessly, I just see a dark screen with the mouse and mouse trails only, can any one help?

    When I connect my Macbook Pro to my Dell DLP projector, either via cable or wirelessly, I just see a dark screen with the mouse and mouse trails only, can any one help?

    jpmarkques post is a good start point, after folling his directions, you can try detect displays. Also try different rsolution and refresh rates.
    Most of the projectors I have used support a 1024X768 res.
    Youcan also try a pram reset if it still does not detect.
    Leave theproctor connected and powered up, power down the MBP.
    Power back up the MBP and hold the following keys before you hear the start up chime:
    Option, command, P,R (no commas) continue to hold these keys till you hear the start up chime 2 times.

  • Safari keeps crashing every time I try to open a link from a different application, i.e. Mail. The trouble report says that some problem occurs with libcooliris.dylib plug-in. Can any one help?

    Safari keeps crashing every time I try to open a link from a different application, i.e. Mail. The trouble report says that some problem occurs with libcooliris.dylib plug-in. Can any one help?
    Thanks!

    Dear Linc,
    Thank you for the advice, John Blanchard1  and Linc Davis
    As suggested in your reference thread I removed "/Library/Printers/hp/PDEs/hpPostScriptPDE.plugin" and the problem has been resolved.
    I am guessing the the plug-in for the hp printers got corrupted and effected every thing, or became unsuitable when I installed an Apple update. I would be most grateful if you can confirm how the problem was coursed so I can understand and learn from this experiance.
    Ash

  • Since itunes and apple tvs latest update I have had problem wtching movies on apple tv via my itunes can any one help, movie takes a very long time to load sometimes never, it use to work really well, whats going on please help?

    Since itunes and apple tvs latest update I have had problem wtching movies on apple tv via my itunes can any one help, movie takes a very long time to load sometimes never, it use to work really well, whats going on please help?

    You might find useful information in item D1 of Time Machine Troubleshooting.

  • I am not able to register my Apple ID for iCloud and the error is "the maximum no of free accounts have been activated on this phone" can any one help me why I need to do

    I am not able to register my Apple ID for iCloud and the error is "the maximum no of free accounts have been activated on this phone" can any one help me why I need to do

    Sir, your Apple ID can be used as an iCloud account as well. They are both the same thing.
    You can learn more from --> Set up your Apple ID for iCloud and iTunes - Apple Support

Maybe you are looking for