Asked by JJ
Enhance bank account class by adding preconditions for the constructor and the deposit method that require the amount parameter to be atleast zero, and a precondition for the withdraw method that requires amount to be a value between 0 and the current balance.Use assertions to test the preconditions.
Answers
Answered by
MathMate
For deposit method:
if(amount<0)
{ // do something to indicate invalid data
}
else
{ // proceed with deposit
}
Similar for withdrawal.
Modifications of this kind is much easier if the class and associated methods are available.
I suggest you try to code the best you can and post what you have, and where you have a difficulty.
if(amount<0)
{ // do something to indicate invalid data
}
else
{ // proceed with deposit
}
Similar for withdrawal.
Modifications of this kind is much easier if the class and associated methods are available.
I suggest you try to code the best you can and post what you have, and where you have a difficulty.
Answered by
shamsa
computer the pay for an employee input wii be:
name of employee
employee number
hourly rate
regular pay will
name of employee
employee number
hourly rate
regular pay will
There are no AI answers yet. The ability to request AI answers is coming soon!