Results 1 to 3 of 3
  1. #1
    aimeelawrence is offline Member
    Join Date
    Sep 2008
    Posts
    2
    Rep Power
    0

    Default Easy Java Assg help!

    I have to do this assignment and I keep getting errors, can anyone help? It's an intro class and this is the second assignment, so it should be pretty basic... I understand it but there's some small issue I'm overlooking.. or maybe a big one? Anyone have any pointers?

    This is what I have -


    public class BankingDriver{
    public static void main(String[] args){
    BankingDriver nicksAcct = new BankingDriver("Nick");
    BankingDriver carolsAcct = new BankingDriver("Carol");

    nicksAcct.setCheckMoney(400);
    nicksAcct.setSaveMoney(500);
    carolsAcct.setCheckMoney(600);
    carolsAcct.setSaveMoney(700);

    setTotalMoney=(checkMoney + saveMoney);
    System.out.println(getTotalMoney);

    nicksAcct.setCheckMoney(500);
    System.out.println(nicksAcct);

    nicksAcct.setCheckMoney(0);
    nicksAcct.setSaveMoney(0);
    carolAcct.setSaveMoney(1700);

    System.out.println("Nick's Savings Account:" + nicksAcct.getSaveMoney());
    System.out.println("Nick's Checking Account:" + nicksAcct.getCheckMoney());
    System.out.println(carolsAcct);

    }
    }



    16 errors found:
    File: C:\Documents and Settings\Aimee Lawrence\BankingDriver.java [line: 3]
    Error: C:\Documents and Settings\Aimee Lawrence\BankingDriver.java:3: cannot find symbol
    symbol : constructor BankingDriver(java.lang.String)
    location: class BankingDriver

    thats my first error




    and this is the assignment.....


    Here is the Banking class: /JavaCS1/src/bankaccount/Banking.java
    Here is what your code must do:

    Create an object called nicksAcct. Nick has $400 in his checking account, and $500 in his savings account.
    Create an object called carolsAcct. Carol has $600 in her checking account, and $700 in her savings account.
    Print out the total amount of money in both accounts (you must use methods from the class here).
    Add $100 to Nick's checking account.
    Print out statisics on Nick's account. This statement: System.out.println(nicksAcct); will do the trick.
    In a series of statements, move all of the money in Nick's account - both checking and savings - to Carol's savings account. This should leave Nick penniless at the end.
    Print out statisics on Nick's account
    Print out statisics on Carol's account

    Your realization of the above specification should go inside the main part of BankingDriver.
    Finally - and this is important - you must provide a comment with every line, in the following way: above each command, say what the line below does.
    Last edited by aimeelawrence; 09-19-2008 at 06:40 PM. Reason: typo

  2. #2
    aimeelawrence is offline Member
    Join Date
    Sep 2008
    Posts
    2
    Rep Power
    0

    Default PLEASE can someone help?

    This is the blue print...

    public class Banking{
    private String name;
    private int checkMoney;
    private int saveMoney;

    public Banking(String who, int checking, int saving){
    name = who;
    checkMoney = checking;
    saveMoney = saving;
    }

    public String getName(){
    return name;
    }

    public int getCheckMoney(){
    return checkMoney;
    }

    public int getSaveMoney(){
    return saveMoney;
    }

    public int getTotalMoney(){
    return(checkMoney+saveMoney);
    }

    public void setCheckMoney(int amt){
    checkMoney = amt;
    }

    public void setSaveMoney(int amt){
    saveMoney = amt;
    }

    public String toString(){
    return(name + " checking: " + checkMoney + " savings: " + saveMoney);
    }

    }



    NOW I'm trying this.. It doesn't work but I know I'm getting closer.


    public class BankingDriver{
    public static void main (String[] args){
    BankingDriver nicksAcct = new BankingDriver("Nick", 400, 500);
    BankingDriver carolsAcct = new BankingDriver("Carol", 600, 700);
    System.out.println = getTotalMoney(checkMoney + saveMoney);

    nicksAcct.setCheckMoney(500);
    System.out.println(nicksAcct);

    nicksAcct.setCheckMoney(400);
    nicksAcct.setSaveMoney(500);
    carolsAcct.setCheckMoney(600);
    carolsAcct.setSaveMoney(700);

    nicksAcct.setCheckMoney(0);
    nicksAcct.setSaveMoney(0);
    carolAcct.setSaveMoney(1700);

    System.out.println("Nick's Savings Account:" + nicksAcct.getSaveMoney());
    System.out.println("Nick's Checking Account:" + nicksAcct.getCheckMoney());
    System.out.println("Carol's Savings Account:" + carolsAcct.getSaveMoney());
    System.out.println("Carol's Checking Account:" + carolsAcct.getCheckMoney());

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,390
    Rep Power
    25

    Default

    If you have 16 errors you will have to go thru them one by one, read them carefully and make the necessary change to the line where the error is.

    The first error you posted says it can't find a class constructor for BankingDriver(String). Where is that class defined? Where is the constructor in that class that takes a String arg?

Similar Threads

  1. Noob question- easy
    By mattonitto in forum New To Java
    Replies: 7
    Last Post: 06-13-2008, 12:26 AM
  2. Easy program...need help (urgent)
    By Zebra in forum New To Java
    Replies: 25
    Last Post: 05-30-2008, 08:51 AM
  3. What does this mean (Very Easy)
    By Zebra in forum New To Java
    Replies: 6
    Last Post: 05-01-2008, 01:46 PM
  4. Easy question
    By JavaNoob in forum New To Java
    Replies: 10
    Last Post: 08-03-2007, 10:28 PM
  5. easy way to study the java springs concept
    By kumar84 in forum New To Java
    Replies: 1
    Last Post: 07-17-2007, 03:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •