What's new
  • Welcome to PHCorner Forums. Take a moment to Sign up and gain unlimited access and extra privileges that guests are not entitled to, such as: All that and more! Registration is quick, simple and absolutely free. Join our community today!

Help Java Banking System

SenpaiMizuki

Addict
Established
Joined
Dec 8, 2017
Messages
281
Reaction score
93
Age
21
Baka naman pwede pahelp
Java jdk tapos may assigned na pin na.
At yung function ay withdraw at deposit lang.. Sisimula sa 0 value.. Di muna need na nag sasave yung balance kasi midterm lang to..
 

mrHazan

Eternal Poster
database sql ba yan paps?
Kaya mo yan.

Hindi ata database yan.
random pin ibibigay sa user tapos sa input output lang daw yan.
Syempre nasasave yung balance pero sa program mismo. Sabi niya kapag nastop na yung program kahit hindi na masave yugn balance.
 

Arcturus

Forum Guru
Kaya mo yan.

Hindi ata database yan.
random pin ibibigay sa user tapos sa input output lang daw yan.
Syempre nasasave yung balance pero sa program mismo. Sabi niya kapag nastop na yung program kahit hindi na masave yugn balance.
kung oop to boss, gui ang kailangan
 

mrHazan

Eternal Poster
Hindi basic program lang yan ng 1st year college.
Good for him na nakaabot siya ng midterm kung ganyan lang hindi niya magawa. JOKE! Hahaha! Sama ko.
Tulungan mo. Bigyan mo ng sample program console lang yan.
 

Arcturus

Forum Guru
Hindi basic program lang yan ng 1st year college.
Good for him na nakaabot siya ng midterm kung ganyan lang hindi niya magawa. JOKE! Hahaha! Sama ko.
Tulungan mo. Bigyan mo ng sample program console lang yan.
grabe boss, pero sige boss subukan ko
 
database xampp ka

para sa edittext mo na Save Pin bahala na ang user sa pin

then sa log in call mo siya pin para ma log in

gamit ka if else para sa empty method or wrong pin
para sa else yan na yung tama example

if(edt1.equals("")
{
System.out print("Please make sure you entered pin");
}else
{
Code mo sa main
}
 

Arcturus

Forum Guru
, Last edited:
eto paps,
Java:
import java.util.Random;
import java.util.Scanner;
public class test2 {
    //Initialize everything that is needed
    Random rand = new Random();
    private int privatePin = rand.nextInt(9999)+1000;
    private double currentMoney = 0;
    //Method to display the ui
    void showUI() {
        System.out.println("===============JAVA BANKING SYSTEM===============");
        System.out.println("Good day, User");
        System.out.println("Your Current Balance: "+this.getCurrentMoney());
        System.out.println("Your PIN is: "+this.getPin());
        System.out.println("What would you like to do?");
        System.out.println("( 1 ) Deposit Cash");
        System.out.println("( 2 ) Withdraw Cash");
        System.out.println("( 3 ) Exit program");
    }
    //Method to process the user's choice
    void Process(int choice) {
        if (choice == 3) {
            System.out.println("===============END OF PROGRAM===============");
            System.exit(0);
        }
        System.out.println("Input how much: ");
        double money = sc.nextDouble();
        System.out.println("Input your PIN: ");
        int pin = sc.nextInt();
        if(pin == this.getPin()) {
        switch(choice) {
        case 1:
            depositCash(money);
            break;
        case 2:
            withrdawCash(money);
            break;
            }
        }
      else
             System.out.println("Invalid PIN");
    }
    //Deposit cash
    void depositCash(double money) {
        currentMoney += money;
    }
    //Withraw cash
    void withrdawCash(double money) {
        if(currentMoney > money) {
            currentMoney -= money;
            System.out.println("Sucessfully Wihtrawn");
        }
        else
            System.out.println("Balance not sufficient");
           
    }
     int getPin() {
        return privatePin;
    }
     double getCurrentMoney() {
         return currentMoney;
     }
    static Scanner sc = new Scanner (System.in);
    public static void main(String []args){
        int choice;
        //Call the class object
        test2 obj = new test2();
        do {
            obj.showUI();
            System.out.println("Input your choice: ");
            choice = sc.nextInt();
            obj.Process(choice);
        }while(true);
    }
}
 
eto paps,
Java:
import java.util.Random;
import java.util.Scanner;
public class test2 {
    //Initialize everything that is needed
    Random rand = new Random();
    private int privatePin = rand.nextInt(9999)+1000;
    private double currentMoney = 0;
    //Method to display the ui
    void showUI() {
        System.out.println("===============JAVA BANKING SYSTEM===============");
        System.out.println("Good day, User");
        System.out.println("Your Current Balance: "+this.getCurrentMoney());
        System.out.println("Your PIN is: "+this.getPin());
        System.out.println("What would you like to do?");
        System.out.println("( 1 ) Deposit Cash");
        System.out.println("( 2 ) Withdraw Cash");
        System.out.println("( 3 ) Exit program");
    }
    //Method to process the user's choice
    void Process(int choice) {
        if (choice == 3) {
            System.out.println("===============END OF PROGRAM===============");
            System.exit(0);
        }
        System.out.println("Input how much: ");
        double money = sc.nextDouble();
        System.out.println("Input your PIN: ");
        int pin = sc.nextInt();
        if(pin == this.getPin()) {
        switch(choice) {
        case 1:
            depositCash(money);
            break;
        case 2:
            withrdawCash(money);
            break;
            }
        }
    }
    //Deposit cash
    void depositCash(double money) {
        currentMoney += money;
    }
    //Withraw cash
    void withrdawCash(double money) {
        if(currentMoney > money) {
            currentMoney -= money;
            System.out.println("Sucessfully Wihtrawn");
        }
        else
            System.out.println("Balance not sufficient");
           
    }
     int getPin() {
        return privatePin;
    }
     double getCurrentMoney() {
         return currentMoney;
     }
    static Scanner sc = new Scanner (System.in);
    public static void main(String []args){
        int choice;
        //Call the class object
        test2 obj = new test2();
        do {
            obj.showUI();
            System.out.println("Input your choice: ");
            choice = sc.nextInt();
            obj.Process(choice);
        }while(true);
    }
}
yown
 
kasi once na alam mo sa pag connect sa db

alam mo na siguro method ng pag kuha ng value sa db

but it's given na kasi na 0 talaga ang naka set sa database

pero update value mo lang sana ang function sa button
 

twojuantwo

Leecher
ATM Class
- with a method - withDraw(Account account, double amount)

BankAccount Class
- balance, accountNumber
- merong set/get methods
- merong debit method
- merong deposit method

User Class
- name, pin, BankAccount

Kung ako sa iyo, yan ang magiging initial na mga classes ko.....kung OOP ang magiging approach mo sa exercise na yan.
It should take you 1 hour. Napakadali nyan... masarap gumawa ng mga ganyang exercises.
 

Online statistics

Members online
1,756
Guests online
4,640
Total visitors
6,396

Forum statistics

Threads
686,596
Messages
13,695,626
Members
1,336,684
Top