🔒 Closed Java-ATM using Method

Status
Not open for further replies.

BototoyTheGreat24

Honorary Poster
Pahingi naman po ng hints kung paano ko magagawang masave yung amount ng pera ng user.
Yung hanggang final output yun pa rin yung total amount. Salamat sa makakatulong!

help.webp
 
napakadali nyan hirap din ako jan dati pero pag ikaw mismo magcode once na marun mo na madali na yan sayo kaya mas mabuti ikaw magcode para mahasa ka
 
10 gcash
import java.util.Scanner;

/**
*
* @author CETMYEVAL
*/
public class atm {

/**
* @param args the command line arguments
*
*
*/
static int amount = 1000;

public static void main(String[] args) {
atm_main();
}

static void atm_main() {
System.out.println("-----ATM------");
System.out.println("1. widro");
System.out.println("2. dpusit");
System.out.println("3. chx balnce");
System.out.println("4. exhit");

System.out.println("chose operatoerin");

int scan = scan();

if (scan == 1) {
withdraw();
}else if(scan== 2){
deposit();
}else if(scan== 3){
dispAmount();
}else if(scan== 4){
System.out.println("ATMExiting...");
}
}

static void withdraw() {
System.out.println("inter amt to be widrone ");
amount -= scan();
System.out.println("colek ur moni");
checkBal();
}

static void deposit() {
System.out.println("inter amt to be u want to dpusit ");
amount += scan();
checkBal();
}

static int scan() {
Scanner sc = new Scanner(System.in);
return sc.nextInt();
}

static void checkBal(){
System.out.println("check balnce? (1 - yes 0 - no)");
if (scan() == 1) {
dispAmount();
}
}
static void dispAmount(){
System.out.println("Balnced = " + amount);
}

}
 
Status
Not open for further replies.

About this Thread

  • 6
    Replies
  • 384
    Views
  • 6
    Participants
Last reply from:
cetmyeval69

Trending Topics

Online now

Members online
361
Guests online
3,253
Total visitors
3,614

Forum statistics

Threads
2,307,470
Posts
29,179,188
Members
1,193,464
Latest member
kimo2030
Back
Top