Preview

NegativeAmountException final

Powerful Essays
Open Document
Open Document
444 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
NegativeAmountException final
Lisa Gamel
CSU Global Campus
ITS320 Basic Programming
Dr. Biswajit Panja
Final
February 26, 2015

/* * Program number: University – ITS-320 – Basic Programming * Name * Date: 02/26/2015 * */

public class NegativeAmountException extends Exception {

private static final long serialVersionUID = 1L;

public NegativeAmountException(String msg) { super(msg); }

public NegativeAmountException() { }

public String toString() { return "NegativeAmountException"; }
}

public class InsufficientFundsException extends Exception {

private static final long serialVersionUID = 1L;

public InsufficientFundsException(String msg) { super(msg); }

public InsufficientFundsException() { }

public String toString() { return "InsufficientFundsException"; }
}

public class BankAccount {

private String name; private double balance;

public BankAccount(String name, double balance) throws NegativeAmountException { setName(name); // throw exception if balance is negative if (balance < 0) { throw new NegativeAmountException("Negative amount"); } setBalance(balance); }

public BankAccount(String name) throws NegativeAmountException { setName(name); setBalance(0); }

public void setBalance(double balance) throws NegativeAmountException {

this.balance = balance; }

public String getName() { return name; }

public void setName(String name) { this.name = name; }

public double getBalance() { return balance; }

/** * Deposit * @param balance */ public void deposit(double balance) throws NegativeAmountException { // throw exception if deposit is negative if (balance < 0) { throw new NegativeAmountException("Negative amount"); } this.balance +=

You May Also Find These Documents Helpful

  • Satisfactory Essays

    1) Describe a local land line phone system based on the following Landline Telephone Components:…

    • 663 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Which of the following answers are true about random-access memory (RAM) as it is normally used inside a personal computer? ( choose two answers)…

    • 957 Words
    • 4 Pages
    Good Essays
  • Satisfactory Essays

    ACC 290 Week 2 Accounting Problems www.paperscholar.com DIRECT LINK TO THIS STUDY GUIDE: http://www.paperscholar.com/acc-290-week-2-accounting-problems/ Instantly Download! Get Better Grades in Less Time! 100% Satisfaction Guarantee…

    • 264 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    ACCT 212 Entire Course Financial Accounting http://sourceofhomework.com/downloads/acct-212-entire-course-financial-accounting/ ACCT 212 Course Project ACCT 212 Week 1 DQ1 Financial Statements ACCT 212 Week 2 DQ1 Prepaid Expenses vs. Unearned Revenue ACCT 212 Week 2 DQ2 Accrual vs. Cash Accounting ACCT 212 Week 3 DQ1 Ethical Business Decisions ACCT 212 Week 3 DQ2 Trade Credit – Accounts Payable ACCT 212 Week 4 DQ1 Inventory Management ACCT 212 Week 4 DQ2 LIFO ACCT 212 Week 4 Midterm ACCT 212 Week 5 DQ1 Non-current Assets and Related Liabilities ACCT 212 Week 5 DQ2 Raising Capital (Cash) ACCT 212 Week 6 DQ1 Stockholders Equity ACCT 212 Week 6 DQ2 Net Income vs. Net Operating Cash ACCT 212 Week 7 DQ1 Financial Statement Analysis ACCT 212 Entire Course Financial Accounting http://sourceofhomework.com/downloads/acct-212-entire-course-financial-accounting/ ACCT 212 Course Project ACCT 212 Week 1 DQ1 Financial Statements ACCT 212 Week 2 DQ1 Prepaid Expenses vs. Unearned Revenue ACCT 212 Week 2 DQ2 Accrual vs. Cash Accounting ACCT 212 Week 3 DQ1 Ethical Business Decisions ACCT 212 Week 3 DQ2 Trade Credit – Accounts Payable ACCT 212 Week 4 DQ1 Inventory Management ACCT 212 Week 4 DQ2 LIFO ACCT 212 Week 4 Midterm ACCT 212 Week 5 DQ1 Non-current Assets and Related Liabilities ACCT 212 Week 5 DQ2 Raising Capital (Cash) ACCT 212 Week 6 DQ1 Stockholders Equity ACCT 212 Week 6 DQ2 Net Income vs. Net Operating Cash ACCT 212…

    • 500 Words
    • 4 Pages
    Satisfactory Essays
  • Good Essays

    2. Then identify the most appropriate sample section technique to gather data for testing the hypothesis.…

    • 1320 Words
    • 7 Pages
    Good Essays
  • Satisfactory Essays

    1. Review the feedback from assignment 8, open your assignment 8 Grade Book, and make all corrections and changes necessary.…

    • 432 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    These assignments are the parallel assignments to the Set A Problems assigned in the Units. The Problem Set B problems will provide guidance about the methodology used to complete the assignments.…

    • 421 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    Financial measures identify what is wrong with an organization, not simply provide a signal that something needs attention.…

    • 7494 Words
    • 30 Pages
    Powerful Essays
  • Satisfactory Essays

    11 Carson, Fran M. 12 Wilson, William A. 13 Utley, Harry T. 21 Fife, Lawrence R. 22 Smith, Lucy K. 31 Fay, Gretchen R. 32 Robey, Glenda B. 33 Schork, Thomas K. 51 Hardy, Barbara T. 99 Kipley, Carson C. Totals…

    • 703 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    The average product cost per set would increase. This is because the fixed costs would be spread over fewer units, causing the cost per unit to rise.…

    • 723 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    Summative Assessment

    • 812 Words
    • 4 Pages

    Whilst I attended clinical placement at xxx Nursing Home, I was asked to accompany the registered nurse (RN) attending zzz Ward, which houses people who have dementia and other similar conditions. During handover, we were advised about an ongoing issue with two of the residents; a married female named Joan (not her real name) and an unmarried man called Barry (not his real name). Barry had been visiting Joan in her room, and making sexual advances to her throughout the day. Both of these residents suffered from severe dementia and were not fully aware of their actions; however, Barry seemed to show intelligence with his behaviour and would wait until the staff were busy with other residents before attempting to visit Joan in her room. This posed a problem to staff as generally there was only one staff member on duty in this ward. The other issue staff were presented with was Joan’s forgetfulness that she is married, and due to that reason she made no attempt to deter Barry. Joan’s husband, who resided upstairs in low care and was of sound mind, had visited Joan during the day and witnessed Barry leaving Joan’s room and had noticed the attention that was being given to his wife from the other resident. He was extremely upset and contacted his son by telephone in a panic due to the situation.…

    • 812 Words
    • 4 Pages
    Good Essays
  • Satisfactory Essays

    Trial Balance Errors

    • 586 Words
    • 3 Pages

    b) If the trial balance can be ‘in balance’ and still have errors, give examples of the type of errors that can occur leaving the trial balance in balance.…

    • 586 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Accounting Poblem 4

    • 2125 Words
    • 9 Pages

    Total PV of net cash flows = NPV + Initial Investment = 8,698.52 + 98,000 = 106,698.52…

    • 2125 Words
    • 9 Pages
    Satisfactory Essays
  • Good Essays

    When a company spends more than it receives during a set period of time, typically a quarter, the company is said to have a negative cash flow. This is often viewed as an indicator of financial ill health by people who are assessing companies to determine whether or not to invest in the company. Many things can influence cash flow, however, and one that's negative should not necessarily be seen as a black mark.…

    • 402 Words
    • 2 Pages
    Good Essays
  • Good Essays

    Incorrect accounting

    • 374 Words
    • 2 Pages

    ” Sullivan directed subordinates to book certain fraudulent adjustments and entries in WorldCom’s general ledger to mask WorldCom’s true performance. The fraudulent adjustments and entries were designed to falsely increase WorldCom’s reported revenue and to falsely decrease WorldCom’s reported expenses…

    • 374 Words
    • 2 Pages
    Good Essays

Related Topics