Question
How can add the image to this code ....??? package task2; import javax.swing.*; public class GraphicalIO { public static void main(String[] args) { String qty,
How can add the image to this code ....???
package task2;
import javax.swing.*;
public class GraphicalIO { public static void main(String[] args) { String qty, amount, VRateP;
qty = JOptionPane.showInputDialog("Enter the quantity of meal"); while (qty.equals("")){ qty = JOptionPane.showInputDialog("Enter the quantity of meal"); }
amount = JOptionPane.showInputDialog("Enter amount in AED"); while (amount.equals("")){ amount = JOptionPane.showInputDialog("Enter amount in AED"); } VRateP = JOptionPane.showInputDialog("Enter VAT Rate(%)"); while (VRateP.equals("")){ VRateP = JOptionPane.showInputDialog("Enter VAT Rate(%)"); }
double amountToDouble=0, VRatePToDouble=0; int qtyToInt=0; int choice = JOptionPane.showConfirmDialog(null, "If you need the total price press Yes?"); if (choice == JOptionPane.YES_OPTION) { amountToDouble = Double.parseDouble(amount); VRatePToDouble = Double.parseDouble(VRateP); qtyToInt = Integer.parseInt(qty);
double vat = qtyToInt * (amountToDouble * ( 1 + (Double.parseDouble(String.valueOf(VRatePToDouble))/Double.parseDouble(String.valueOf(100)))));
JOptionPane.showMessageDialog(null, "VAT amount in AED " + (vat - amountToDouble) + " Total Amount in AED " + vat); } else { JOptionPane.showMessageDialog(null, "Cancelled."); }
} }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started