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 3 of 3

Thread: What do I have wrong? And no, this is not a homework problem.

  1. #1
    Member
    Join Date
    Aug 2013
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default What do I have wrong? And no, this is not a homework problem.

    My code for the particular piece of the program that is having the error:

    public class BankAccount extends Account {
    	protected double minimumBalance;
     
    	public double getMinimumBalance () {
    		return minimumBalance;
    	}
     
    	public setMinimumBalance (double minimum) {
    		minimumBalance = minimum;
    	}
     
    	public deposite (double amount) {
    		setBalance(balance + amount);
    	}
     
    	public void withdraw (double amount) {
    		if (balance - amount < minimumBalance) {
    			System.err.println("Error: attempted to withdraw below minimum balance.");
    		}
    		else {
    			setBalance(balance - amount);
    		}
    	}
    }

    Here are the two errors:

    JavaError.JPG


  2. #2
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: What do I have wrong? And no, this is not a homework problem.

    Copy and paste the full error messages here and indicate which line of code they relate to.

    --- Update ---

    Take a close look at the setMinimumBalance and deposite methods. Something missing?

    But in future post all relevant information in your post. Most people refuse to follow links
    Improving the world one idiot at a time!

  3. #3
    Member
    Join Date
    May 2013
    Posts
    106
    My Mood
    Amused
    Thanks
    16
    Thanked 9 Times in 9 Posts

    Default Re: What do I have wrong? And no, this is not a homework problem.

    It looks like you forgot to declare a return type in setMinimumBalance and deposite. If you don't want to return anything, set that as void.

Similar Threads

  1. Homework help what am I doing wrong?
    By Spreadhisword in forum What's Wrong With My Code?
    Replies: 24
    Last Post: April 24th, 2013, 07:38 PM
  2. Question about homework problem.
    By Rain_Maker in forum Java Theory & Questions
    Replies: 13
    Last Post: February 7th, 2013, 08:11 PM
  3. [Problem] What's wrong with my code
    By Javanoo89 in forum Object Oriented Programming
    Replies: 4
    Last Post: November 28th, 2011, 03:22 AM
  4. variable might not be initialized problem. Can someone tell me whats wrong?
    By NewAtJava in forum What's Wrong With My Code?
    Replies: 3
    Last Post: November 10th, 2011, 09:25 AM
  5. Homework problem (scanner problems)
    By TommyFiz in forum File I/O & Other I/O Streams
    Replies: 2
    Last Post: September 20th, 2009, 06:10 PM