Java and Javascript help


How would you write this in Java:
const name = prompt("…");
const rate = prompt("…");
alert(... ${name - (name * rate / 100) });

import javax.swing.JOptionPane;

// one class needs to have a main() method
public class HelloWorld
  // arguments are passed using the text field below this editor
  public static void main(String[] args)
     //since u multiplied variable name with rate,
      //I assume u mean it a number
      //double is used for decimal point numbers
      //because rate is usually decimal point
      //I used double for both
      double name=5;
      double rate= 2.5;
      double result = ((name * (rate / 100)) - name);
      JOptionPane.showMessageDialog( null, "result is: " + result );


Thank you very much!


please test it to see if you like it…
Here is more “JOptionPane” examples in the website below


you are very welcome. Make sure to test it