0% found this document useful (0 votes)
143 views3 pages

ClearTrip Coding Standards

The document describes an interview question where the candidate was asked to build a mini bank application with basic functionality like creating an account, depositing money, withdrawing money up to a daily limit, and checking the balance. The candidate implemented the application and included code for creating an account class with fields for ID, name and bank code. Methods were included for depositing, withdrawing up to the daily limit while handling exceptions, and getting the account details as a string. The code was submitted for review on an online forum to get feedback.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
143 views3 pages

ClearTrip Coding Standards

The document describes an interview question where the candidate was asked to build a mini bank application with basic functionality like creating an account, depositing money, withdrawing money up to a daily limit, and checking the balance. The candidate implemented the application and included code for creating an account class with fields for ID, name and bank code. Methods were included for depositing, withdrawing up to the daily limit while handling exceptions, and getting the account details as a string. The code was submitted for review on an online forum to get feedback.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Today I went to an interview with the Cleartrip software company.

For the first round


programming, we need to build a mini bank application.

In the question paper they clearly mentioned that no data persistence is required.

 Create an account
 Deposit money
 Withdraw money, honor daily withdrawal limit.
 Check the balance
This is what I did on my own, and I was getting rejected.

import java.util.Scanner;

public class CreateAccount {


int accountid;
String accountantname;
String IFSCcode;

public CreateAccount(int accountid,String accountantname,String IFSCcode){


this.accountid = accountid;
this.accountantname = accountantname;
this.IFSCcode = IFSCcode;
}

/*//adding deposit money with the balance


public double despositMoney() throws MiniumAmountDeposit{
double Currentbalance = 0.00;
Scanner scn = new Scanner(System.in);
System.out.println("please enter the deposit amount");
double Depositamount = scn.nextDouble();
Currentbalance += Depositamount ;
System.out.println("your currentbalance="+Currentbalance);

return Currentbalance;
}*/

//withdrawl money and set daily withdrawl limit


public void WithdrawMoney() throws InsufficientBalException, MiniumAmountDeposit{

double Currentbalance = 0.00;


Scanner deposit = new Scanner(System.in);
System.out.println("please enter the deposit amount");
double Depositamount = deposit.nextDouble();
Currentbalance += Depositamount ;
System.out.println("your currentbalance="+Currentbalance);

/*double Currentbalanace = despositMoney();*/

//setDaily Withdrawl limit


final double setDailyLimit = 2500.00;

Scanner withDraw = new Scanner(System.in);


System.out.println("please enter the withdraw amount");
double WithdrawMoney =withDraw.nextDouble();
if(Currentbalance < WithdrawMoney)
System.out.println("you have less amount : your current balance is="+Currentbalance);

else if (WithdrawMoney > setDailyLimit)


System.out.println("you have entered amount exceed than daily limit : your
dailyLimit="+setDailyLimit);

else
Currentbalance -= WithdrawMoney;
System.out.println("your current balance is="+Currentbalance);

/*public void setWithdrawlLimit()throws exceedLimit{


Scanner scn = new Scanner(System.in);
System.out.println("please enter the withdraw amount");
double enterAmount = scn.nextDouble();
double DailysetLimit = 2500;

if(enterAmount>DailysetLimit)
System.out.println("you have exceed daily limit : your dailyLimit"+DailysetLimit);

}*/

public String toString(){

return "accountid="+this.accountid + "accountantname="+this.accountantname +


"IFSCcode="+this.IFSCcode;
}

public static void main(String[] args){


CreateAccount account = new CreateAccount(1234455533,"samy","ICIC09");
System.out.println("you have created account : " +account);
/*
try {
account.despositMoney();
} catch (MiniumAmountDeposit e) {
// TODO Auto-generated catch block
e.printStackTrace();
}*/

try {
account.WithdrawMoney();
} catch (InsufficientBalException | MiniumAmountDeposit e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

/*try {
account.setWithdrawlLimit();
} catch (exceedLimit e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

*/
}

https://codereview.stackexchange.com/questions/188306/mini-bank-application

You might also like