errori ed eccezioni durante l'eseguzionie del programma:
nella prima lista di errori dopo l'eccezione sottoscritta ci sono quelli riguardanti alla premitura del bottone dividendicodice:Exception in thread "AWT-EventQueue-0" java.lang.ArithmeticException: / by zero at ripartoutilespa.riparto.getDividendi(riparto.java:87) at ripartoutilespa.RipartoutileSPAView.btndividendiActionPerformed(RipartoutileSPAView.java:706) at ripartoutilespa.RipartoutileSPAView.access$1100(RipartoutileSPAView.java:23) at ripartoutilespa.RipartoutileSPAView$7.actionPerformed(RipartoutileSPAView.java:242) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2012) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2335) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:404) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:253) at java.awt.Component.processMouseEvent(Component.java:6175) at javax.swing.JComponent.processMouseEvent(JComponent.java:3267) at java.awt.Component.processEvent(Component.java:5940) at java.awt.Container.processEvent(Container.java:2105) at java.awt.Component.dispatchEventImpl(Component.java:4536) at java.awt.Container.dispatchEventImpl(Container.java:2163) at java.awt.Component.dispatchEvent(Component.java:4362) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4461) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4125) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4055) at java.awt.Container.dispatchEventImpl(Container.java:2149) at java.awt.Window.dispatchEventImpl(Window.java:2478) at java.awt.Component.dispatchEvent(Component.java:4362) at java.awt.EventQueue.dispatchEvent(EventQueue.java:604) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:275) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:200) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177) at java.awt.EventDispatchThread.run(EventDispatchThread.java:138) Exception in thread "AWT-EventQueue-0" java.lang.ArithmeticException: / by zero at ripartoutilespa.riparto.getDividendi(riparto.java:87) at ripartoutilespa.riparto.getRimanente(riparto.java:103) at ripartoutilespa.RipartoutileSPAView.btnrimanenteActionPerformed(RipartoutileSPAView.java:712) at ripartoutilespa.RipartoutileSPAView.access$1200(RipartoutileSPAView.java:23) at ripartoutilespa.RipartoutileSPAView$8.actionPerformed(RipartoutileSPAView.java:252) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2012) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2335) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:404) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:253) at java.awt.Component.processMouseEvent(Component.java:6175) at javax.swing.JComponent.processMouseEvent(JComponent.java:3267) at java.awt.Component.processEvent(Component.java:5940) at java.awt.Container.processEvent(Container.java:2105) at java.awt.Component.dispatchEventImpl(Component.java:4536) at java.awt.Container.dispatchEventImpl(Container.java:2163) at java.awt.Component.dispatchEvent(Component.java:4362) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4461) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4125) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4055) at java.awt.Container.dispatchEventImpl(Container.java:2149) at java.awt.Window.dispatchEventImpl(Window.java:2478) at java.awt.Component.dispatchEvent(Component.java:4362) at java.awt.EventQueue.dispatchEvent(EventQueue.java:604) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:275) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:200) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177) at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)
nella seconda quelli riguardanti il bottone rimanenti.
comunque ho solo capito che riguarda a qualche divisione x/0 che risulta da qualche parte che blocca l'esecuzione regolare dei calcoli che il computer fa perchè gli è stato ordinato.codice:Exception in thread "AWT-EventQueue-0" java.lang.ArithmeticException: / by zero
sopratutto sembra riguardi tale metodo che non capisco dove ho sbagliato.
con la variabile nazioni indica numero azioni è scritta male e sembra nazioni invece è numero azioni.codice:public double getDividendi() { double x = 0, y = 0, dividendo = 0; int nazioni = 0; nazioni = (int)(getCapsoc() / getVn()); if (getutiledaDistribuire() > 0) { dividendo = getutiledaDistribuire() / nazioni; x = getArrotodamento(dividendo, arrotodamento); y= x*nazioni; } else if (getutiledaDistribuire() == 0) { System.err.println("non c'è utile da distribuire per gli azionisti"); y = 0; } else { System.err.println("è rilevata una perdita "); } return y; }
negli errori indica tale calcolo mi sembra.

Rispondi quotando