Trouble with this java error, could anyone help please?

if (textinput.equals(“Haiti”))

			{

                      JOptionPane.showMessageDialog(null, "Haiti is currently in URGENT need of aid!");

		  firstdonate = JOptionPane.showInputDialog("How much would you like to donate to Haiti?");	

                 

      			firstdonate = Integer.parseInt(totalcharity);



    		        moneyleft = (donatetotal-firstdonate);

      

  			        System.out.println( "You have "+moneyleft+" pounds left.");

This is the error message that keeps appearing:

ages2.java:44: incompatible types
found : java.lang.String
required: int
firstdonate = JOptionPane.showInputDialog(“How much would you like to donate to Haiti?”);

How would i solve this error? thank you

The method showInputDialog on JOptionPane returns a String value. My guess is that your attribute firstdonate is an int.

You will have to cast the value returned from the showInputDialog method to an int.

Perhaps something like this?


firstdonate = Integer.valueOf(JOptionPane.showInputDialog("How much would you like to donate to Haiti?"));