Explain and add it to a class called numeric


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.

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.

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.

Request for Solution File

Ask an Expert for Answer!!
Finance Basics: Explain and add it to a class called numeric
Reference No:- TGS0516737

Expected delivery within 24 Hours