Advertisement
akosiraff

CashRegister_BankAccount_Numeric JAVA

Dec 1st, 2013
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1.  
  2. Download: http://solutionzip.com/downloads/cashregister_bankaccount_numeric-java/
  3. 1: Real cash registers can handle both bills and coins. Design a single class that expresses the commanality of these concepts. Redesign the CashRegister class and provide a method for entering payments that are described by your class. Your primary challenge is to comeup with a good name for the classes.
  4. 2: Enchance teh BankAccount class by adding preconditions for the constructor and teh deposit method that require the amount parameter to be at least zero, and a precondition for the withdraw method that requires amount ot be a value between 0 and the current balance. Use assertions to test the preconditions.
  5. 3: Consider the following algorithm for computing xn for an integer n. If < 0,xn is 1/x-n. If n is positive and even, then xn=(xn/2)2. If n is positive and odd, then xn=xn-1 . x. Implement a static method double intPower (double x, int n) that uses this algorithm. Add it to a class called Numeric.
  6. Download: http://solutionzip.com/downloads/cashregister_bankaccount_numeric-java/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement