Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.JOptionPane;
- import java.lang.String;
- public class ex2 {
- public static void main(String[] args){
- String km = JOptionPane.showInputDialog(null,"Please enter the amount of km");
- double km1 = Float.parseFloat(km);
- double km2;
- if(km1 < 10)
- {
- km2 = km1 * 0.7;
- }
- else{
- km2 = km1 * 0.10;
- }
- JOptionPane.showMessageDialog(null,"the distance cylced is" + km1 + "money due is" + km2 );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement