week1-CodingAssessment
week1-CodingAssessment
deposit(float amt) method allows you to credit an amount into the current
balance. If amount is negative, throw an exception
InvalidAmountException to block the operation from being performed.
Add constructor in Account to which you will pass, accno, custname, acctype
and initial balance and check whether the balance is less than 1000 in case
of savings account and less than 5000 in case of a current account. If so,
then raise a LowBalanceException.
In either case if the balance is negative then raise the
InvalidAmountException exception accordingly.
Classes to be created.
package com.ig.model
Class Account {
Integer accNumber;
String custName;
String type;// String (indicates ‘Savings’ or ‘Current’) { use ENUM)
Float balance;
}
Package com.ig.service
Class AccountService {
List<Account> accountList=new ArrayList<>();
Boolean isValidAccount(int acNumber)
void deposit(float amt);
void withdraw(float amt);
float getBalance();
}
package com.ig.ui
Class AccountTest{
Public static void main(String args[]) {
== call methods
}
}
Package com.ig.exception;
class InsufficientFundsException {
}
Class InvalidAmountException {
}
Class LowBalanceException {
}
Node: submit Zipfile with all java files and screenshot of execution. Name of
file- week1solution.zip