fork download
  1. package bankmanegment;
  2. import java.util.Scanner;
  3. class Bank
  4. {
  5. public String name,actype;
  6. public long acnum;
  7. public float opbal;
  8. Scanner scanner = new Scanner (System.in);
  9. void openac()
  10. {
  11. System.out.print("Enter Your Name => ");
  12. name=scanner.nextLine();
  13. System.out.print("Enter Account Number =>");
  14. acnum=scanner.nextLong();
  15. System.out.print("Seclect Ac Type \n 1.Saving ac \n 2.Curent ac \n 3.Joint ac \n");
  16. System.out.print("Select Your Ac Type => ");
  17. int n=scanner.nextInt();
  18.  
  19. switch(n)
  20. {
  21. case 1 :
  22. {
  23. actype = "Saving";
  24. break;
  25. }
  26. case 2 :
  27. {
  28. actype = "Current";
  29. break;
  30. }
  31. case 3 :
  32. {
  33. actype = "Current";
  34. break;
  35. }
  36. }
  37.  
  38. //String actyp = scanner.nextLine();
  39. System.out.print("Enter Your Ac Opening Bal => ");
  40. opbal=scanner.nextFloat();
  41. }
  42. void showac()
  43. {
  44. System.out.println("Account Holder Name => "+name);
  45. System.out.println("Account Holder Number => "+acnum);
  46. System.out.println("Account Type => "+actype);
  47. }
  48. void deposite()
  49. {
  50. float deposit;
  51. System.out.print("Enter Diposit Ammount => ");
  52. deposit = scanner.nextFloat();
  53. opbal+=deposit;
  54. System.out.print("Enter Your Ac Opening Bal => "+opbal);
  55. }
  56. void withdraw()
  57. {
  58. int wd;
  59. System.out.print("Enter Withdraw Ammount => ");
  60. wd=scanner.nextInt();
  61. if(wd>opbal)
  62. {
  63. System.out.print("\nPLEASE MENTEN BALENCE IN YOUR AC !!");
  64. }
  65. else
  66. {
  67. System.out.print("\n AFTER WHITHDRAW AC BAL => "+opbal);
  68. }
  69.  
  70. }
  71. void serch()
  72. {
  73. long ser;
  74. System.out.print("ENTER AC NUMBER => ");
  75. ser=scanner.nextLong();
  76. if(ser==acnum)
  77. {
  78. System.out.print("Account Holder Name => "+name);
  79. System.out.print("Account Holder Number => "+acnum);
  80. System.out.print("Account Type => "+actype);
  81. System.out.println("Currant Balence In Your Ac => "+opbal);
  82. }
  83. else
  84. {
  85. System.out.print("NOT FOUND YOUR AC ");
  86. }
  87. }
  88. }
  89. public class Bankmanegment
  90. { public static void main(String[] args)
  91. {
  92. int se;
  93. do
  94. {
  95.  
  96. System.out.println(" \t\t\t Welcome to Axis ATM Banking ");
  97. System.out.print("\n 1.OPEN ACCOUNT ");
  98. System.out.print("\t 2.SHOW ACCOUNT ");
  99. System.out.print("\n 3.DEPOSITE AMMOUNT ");
  100. System.out.print("\t 4.WITHDRAWALL AMMOUNT ");
  101. System.out.print("\n 5.SEARCH ACCOUNT ");
  102. System.out.print("\t 6.CANCEL TRANSTECTION & EXITE ");
  103.  
  104. System.out.print("\n\n\t\tCHOOSE ANY BANKING FACILITY = ");
  105. Scanner scanner = new Scanner(System.in);
  106. se = scanner.nextInt();
  107.  
  108.  
  109.  
  110. Bank b1 =new Bank();
  111.  
  112. switch(se)
  113. {
  114. case 1 -> {
  115. b1.openac();
  116. break;
  117. }
  118. case 2 -> {
  119. b1.showac();
  120. break;
  121. }
  122. case 3 -> {
  123. b1.deposite();
  124. break;
  125. }
  126. case 4 -> {
  127. b1.withdraw();
  128. break;
  129. }
  130. case 5 -> {
  131. b1.serch();
  132. break;
  133. }
  134. case 6 -> {
  135. System.out.print("THANKS FOR VISIT YOU ARE EXITE ");
  136. }
  137. }
  138.  
  139. }
  140. while(se!=6);
  141. }
  142.  
  143. }
  144.  
Success #stdin #stdout 0.02s 26128KB
stdin
Standard input is empty
stdout
package bankmanegment;
import java.util.Scanner;
class Bank 
{
    public String name,actype;
    public long acnum;
    public float opbal;
    Scanner scanner = new Scanner (System.in);
    void openac()
    {
        System.out.print("Enter Your Name => ");
        name=scanner.nextLine();
        System.out.print("Enter Account Number =>");
        acnum=scanner.nextLong();
        System.out.print("Seclect Ac Type \n 1.Saving ac \n 2.Curent ac \n 3.Joint ac \n");
        System.out.print("Select Your Ac Type => ");
        int n=scanner.nextInt();
      
        switch(n)
        {
            case 1 :
            {
                actype = "Saving";
                break;
            }
            case 2 :
            {
                actype = "Current";
                break;
            }
            case 3 :
            {
                actype = "Current";
                break;
            }
        }
        
        //String actyp = scanner.nextLine();
        System.out.print("Enter Your Ac Opening Bal => ");
        opbal=scanner.nextFloat();
    }
    void showac()
    {
        System.out.println("Account Holder Name => "+name);
        System.out.println("Account Holder Number => "+acnum);
        System.out.println("Account Type => "+actype);
    }
    void deposite()
    {
        float deposit;
        System.out.print("Enter Diposit Ammount => ");
        deposit = scanner.nextFloat();
        opbal+=deposit;
        System.out.print("Enter Your Ac Opening Bal => "+opbal);    
    }
    void withdraw()    
    {
        int wd;
        System.out.print("Enter Withdraw Ammount => ");
        wd=scanner.nextInt();
        if(wd>opbal)
        {
            System.out.print("\nPLEASE MENTEN BALENCE IN YOUR AC !!");
        }
        else
        {
            System.out.print("\n AFTER WHITHDRAW AC BAL => "+opbal);   
        }
        
    }
    void serch()
    {
       long ser;
        System.out.print("ENTER AC NUMBER => ");
        ser=scanner.nextLong();
        if(ser==acnum)   
        {
             System.out.print("Account Holder Name => "+name);
             System.out.print("Account Holder Number => "+acnum);
             System.out.print("Account Type => "+actype);
             System.out.println("Currant Balence In Your Ac => "+opbal);
        }
        else
        {
             System.out.print("NOT FOUND YOUR AC ");
        }
    }
}
public class Bankmanegment
{  public static void main(String[] args)
    {
        int se;
        do
        {
       
            System.out.println(" \t\t\t Welcome to Axis ATM Banking  ");
             System.out.print("\n 1.OPEN ACCOUNT ");
            System.out.print("\t 2.SHOW ACCOUNT ");
            System.out.print("\n 3.DEPOSITE AMMOUNT ");
            System.out.print("\t 4.WITHDRAWALL AMMOUNT ");
            System.out.print("\n 5.SEARCH ACCOUNT ");
            System.out.print("\t 6.CANCEL TRANSTECTION & EXITE ");
            
            System.out.print("\n\n\t\tCHOOSE ANY BANKING FACILITY = ");
            Scanner scanner = new Scanner(System.in);
            se = scanner.nextInt();
         
           
         
          Bank b1 =new Bank();
                
          switch(se)
          {
             case 1 ->              {
                 b1.openac();
                 break;
             }
             case 2 ->              {
                 b1.showac();
                 break;
             }
             case 3 ->              {
                 b1.deposite();
                 break;
             }
             case 4 ->              {
                 b1.withdraw();
                 break;
             }
             case 5 ->              {
                 b1.serch();
                 break;
             }
             case 6 -> {
                 System.out.print("THANKS FOR VISIT YOU ARE EXITE ");
             }
          }
         
        }
        while(se!=6);
    }
    
}