why does it keep showing that a code is undefined in JOptionPane?

39 Views Asked by At

I am a begginner and i am trying to run this code but it keeps showing problems This is my code:

package detyra:
import javax.swing.JOptionPane;

public class Vendingmachine{
    public static void main(String[] args) {
     
        String response;
        int dollarbills,stamps,change;
        response=JOptionPane.showInputDialog(null, "Enter Dollarbill");
        dollarbills=int.parsedouble(response);
        stamps=dollarbills/47;
        change=dollarbills%47;      
        JOptionPane.showMessageDialog(null,"Dollar bill:"
            + dollarbills + "\nStamps:" +stamps +"\nChange:"  +change);                           
    }
}

And these are the problems:

The method showInputDialog(null, String) is undefined for the type JOptionPane  JOptionPane.java    /detyra/src/javax/swing line 13 Java Problem
Description Resource    Path    Location    Type
The method showInputDialog(null, String) is undefined for the type JOptionPane  Vendingmachine.java /detyra/src/detyra  line 10 Java Problem
Description Resource    Path    Location    Type
The method showMessageDialog(null, String) is undefined for the type JOptionPane    JOptionPane.java    /detyra/src/javax/swing line 18 Java Problem
Description Resource    Path    Location    Type
The method showMessageDialog(null, String) is undefined for the type JOptionPane    Vendingmachine.java /detyra/src/detyra  line 15 Java Problem
0

There are 0 best solutions below