GUI calculate button coding error in java
<p>Okay, first of all the project I am working on has two packages, first is murach.business which contains invoiceCalculations.java Second is murach.forms which contain InvoiceForm.java(JFrame) and SwingValidator.java</p>

<p>I need to add an event handler for the actionPerformed event of the Calculate button. Add code to this event handler that gets the customer type and subtotal from the form, uses the calculateDiscountPct method in the InvoiceCalculations class to calculate the the discount percent based on those values, calculates the discount amount and total, and formats and displays the values on the form.</p>

<p>The form has 5 rows for instance first customer type, subtotal, discount percent, discount amount and total and below that is calculate and exit button.</p>

<p>Here is the stack trace:</p>

<pre><code>run:
Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "R"
    at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1222)
    at java.lang.Double.parseDouble(Double.java:510)
    at murach.forms.InvoiceForm.calculateButtonActionPerformed(InvoiceForm.java:183)
    at murach.forms.InvoiceForm.access$300(InvoiceForm.java:15)
    at murach.forms.InvoiceForm$4.actionPerformed(InvoiceForm.java:81)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
    at java.awt.Component.processMouseEvent(Component.java:6382)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3275)
    at java.awt.Component.processEvent(Component.java:6147)
    at java.awt.Container.processEvent(Container.java:2083)
    at java.awt.Component.dispatchEventImpl(Component.java:4744)
    at java.awt.Container.dispatchEventImpl(Container.java:2141)
    at java.awt.Component.dispatchEvent(Component.java:4572)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4619)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4280)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4210)
    at java.awt.Container.dispatchEventImpl(Container.java:2127)
    at java.awt.Window.dispatchEventImpl(Window.java:2489)
    at java.awt.Component.dispatchEvent(Component.java:4572)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:704)
    at java.awt.EventQueue.access$400(EventQueue.java:82)
    at java.awt.EventQueue$2.run(EventQueue.java:663)
    at java.awt.EventQueue$2.run(EventQueue.java:661)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
    at java.awt.EventQueue$3.run(EventQueue.java:677)
    at java.awt.EventQueue$3.run(EventQueue.java:675)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:674)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
BUILD SUCCESSFUL (total time: 25 seconds)
</code></pre>

<p>So far I am getting error when i hit calculate button for my code. This is my current code, could you tell me what changes i need to make to code and why?</p>

<pre><code>private void calculateButtonActionPerformed(java.awt.event.ActionEvent evt) {                                                
      // TODO add your handling code here:
   double c = Double.parseDouble(customertypeTextField.getText());
   double s = Double.parseDouble(subtotalTextField.getText());
   pct d = Percent.parsepct(discountpercentTextField.getText());
   double a = Double.parseDouble(discountamountTextField.getText());
   double total = InvoicCalculations.calculateTotal(c, s, d);
   NumberFormat currecny = NumberFormat.getCurrencyInstance();
   totalTextField.setText(currency.format(total));
}                                               
</code></pre>
