Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. import javax.swing.JOptionPane;
  2. import java.lang.String;
  3.  
  4.  
  5. public class ex2 {
  6.  
  7. public static void main(String[] args){
  8.  
  9. String km = JOptionPane.showInputDialog(null,"Please enter the amount of km");
  10.  
  11. double km1 = Float.parseFloat(km);
  12. double km2;
  13. if(km1 < 10)
  14. {
  15. km2 = km1 * 0.7;
  16. }
  17. else{
  18. km2 = km1 * 0.10;
  19. }
  20.  
  21. JOptionPane.showMessageDialog(null,"the distance cylced is" + km1 + "money due is" + km2 );
  22.  
  23.  
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement