Java Application - Smart Tech Guides

Latest

Hi this is Sravan Kumar from India. SMART TECH GUIDES is a technical blog. it helps you to learn about Java topics, frameworks and tools like Jenkins, GitHub & related explanations, data base related topics. All these Explanations are explained in simple and understandable manner.

Subscribe Us

SMART TECH GUIDES

Java Application

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);
}
}
view raw HdfcBank.java hosted with ❤ by GitHub


step5) after composing code run Java application.


Note: here results will be displayed on console.


http://smarttechguides.blogspot.com/

because we are using System.out.println() method thats why results will be displayed on console.

No comments:

Post a Comment