Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: JAVA Beginner needs help

  1. #1
    Junior Member
    Join Date
    Feb 2012
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default JAVA Beginner needs help

    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


  2. #2
    Member snowguy13's Avatar
    Join Date
    Nov 2011
    Location
    In Hyrule enjoying a chat with Demise and Ganondorf
    Posts
    339
    My Mood
    Happy
    Thanks
    31
    Thanked 48 Times in 42 Posts

    Default Re: JAVA Beginner needs help

    Welcome to the forums, rhaupert! Make sure to read the rules.

    Firstly, this forum is for introducing yourself only; if you have program issues, be sure to post in the correct subforum (in this case, I think What's Wrong With My Code would be most appropriate).

    Secondly, make sure to surround you code in highlight tags, like this:
    [highlight=Java]//your code here[/highlight]

    Finally, what is your problem? You never say what your code is supposed to do nor what your problem is... Are you getting errors (if so, post them), or is the code not doing what you want it to?
    Use highlight tags to help others help you!

    [highlight=Java]Your prettily formatted code goes here[/highlight]

    Using these tags makes your code formatted, and helps everyone answer your questions more easily!




    Wanna hear something funny?

    Me too.

Similar Threads

  1. Java Beginner
    By kney in forum Java Theory & Questions
    Replies: 10
    Last Post: October 18th, 2011, 07:38 AM
  2. Help for java beginner
    By sarasaleem in forum Exceptions
    Replies: 6
    Last Post: October 10th, 2011, 08:56 PM
  3. Another beginner to Java!
    By jwise95 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: April 21st, 2011, 05:27 PM
  4. Java Beginner Here!
    By j3nn42o in forum The Cafe
    Replies: 10
    Last Post: January 10th, 2011, 04:57 AM
  5. Java Beginner
    By rannoune in forum Java Theory & Questions
    Replies: 3
    Last Post: December 25th, 2009, 03:30 AM