I am in my first online Java programming class and I am trying to write a program with classes and I can't seem to see what I am missing when I tried to write a small section just so I could figure out how to call the class and I keep getting an error. I have copied the small part that I have written below. Any help would be greatly appreciated.
import javax.swing.JOptionPane;
import java.text.NumberFormat;
public class Chapter7Prog1RandyHaupert
{
public static void main (String [] args)
{
int quarters, dimes, nickels, pennies;
double totalamount = 0;
String input = JOptionPane.showInputDialog (null, "How many quaters do you have. " );
quarters = Integer.parseInt (input);
quarters = Coins.getQuarters (dimes);
}
}
import java.text.DecimalFormat;
public class Coins
{
public final DecimalFormat MONEY = new DecimalFormat( "$#,##0.00" );
public Coins( int newQuarters, int newDimes, int newNickels, int newPennies )
{
setQuarters( newQuarters );
setDimes( newDimes );
setNickels( newNickels );
setPennies( newPennies );
}
/** getQuarters method
* @return number of dimes
*/
public int getQuarters( )
{
if (Quarters == 0)
{
System.out.print ("You have no quarters.\n" );
}
else
{
return Quarters;
}
}
}
Randy