Java Application
Task: Developing Bank Application with some functionalities and Displaying Result on console.
step1) choose editors, notepad or IDE(eclipse, NetBeans, etc..!).
step2) select new Java Project write package and class name.
step3) write code/business logic inside src/Java class.
step4) add JDK to build-path.
Note: JDK contains compilers and libraries, it helps us to develop Java application.
Java Code
package com.smarttechguides; | |
public class HdfcBank { | |
double totalBalance; | |
static String bankName = "HDFC Bank"; | |
static String bankIfscCode = "HDFC0125"; | |
public boolean pinValidate(int pin) { | |
if (pin == 1234) { | |
System.out.println("valid pin..."); | |
depositeAmount(200.25); | |
withdrawnAmount(15); | |
depositeAmount(2); | |
} else { | |
System.out.println("invalid pin..."); | |
} | |
return true; | |
} | |
public double depositeAmount(double amount) { | |
totalBalance = totalBalance + amount; | |
System.out.println("deposite amount " + amount + " rs" + '\n' + "total balance is " + totalBalance + " rs"); | |
return totalBalance; | |
} | |
public double withdrawnAmount(double amount) { | |
if (totalBalance <= amount) { | |
System.out.println("unable to proceed..."); | |
} else { | |
totalBalance = totalBalance - amount; | |
System.out.println( | |
"withdrwan amount is " + amount + "rs" + '\n' + "total balance is " + totalBalance + "rs"); | |
} | |
return totalBalance; | |
} | |
public static void main(String[] args) { | |
HdfcBank bank = new HdfcBank(); | |
bank.pinValidate(1234); | |
System.out.println(bankName); | |
System.out.println(bankIfscCode); | |
} | |
} |
No comments:
Post a Comment