مشروع حسابات بنكية (جافا), مشكلة في الحسابات باستخدام array

amro • منذ 4 سنوات

هذا جزء من البرنامج الخاص بي

1- مشكلتي التي  حللتها انه على سبيل المثال اذا اردت ادراج 50 حساب بشكل غير متتال قمت بوضع break وحللت المشكلة تقريبا (اي اصبحت اكتب حساب واحد فيخرج البرنامج من case 1 )

2- عند عمل create لحساب ثم بعدها لحساب اخر اجد ان البرنامج قام بكتابة الحساب الثاني فوق الاول !! ( يمكنك فهم ما اقصد عن طريق كود الكومنت في الاسفل قبل case 2 )

3- مشكلتي انه عندما اريد تحديد ID معين وايداع مبلغ معين فيه فكيف اجعل البرنامج يذهب الىID الموجود في ال array وايداع القيمة في array ( هذه العميلة سأنفذها في *case 2 *deposit  )

ملاحظة * غير مسموح استخدام ال ArrayList

public static void main(String[] args){ 
        Scanner keyboard = new Scanner (System.in);
        String Administrator = "Amro" ;
        String Password = "1234567";
        System.out.println("login the bank system ");
        System.out.println("1- login as Administrator ");
        System.out.println("2- login as a user ");
        System.out.println("3- Exit ");
        int x = keyboard.nextInt() ;
        switch(x){
            case 1 :               
                System.out.println("Enter username :");
                String username = keyboard.next();
                System.out.println("Enter Password :");
                String password = keyboard.next();
                if(username.equals(Administrator) && password.equals(Password)){
                 System.out.println("Enter type of operation :");
                    }else{ System.out.println("ERORR!!!!");
                       System.exit(0);}               
                boolean isRunning = true;
                while(isRunning){
                 System.out.println("1- Create a new account");
                  System.out.println("2- Deposit an amount in the account");
                   System.out.println("3- Withdraw an amount in the account");
                    System.out.println("4- Modify the customer data");
                     System.out.println("5- Delete the bank account");
                      System.out.println("6- Search for a bank account");
                       System.out.println("7- View all bank account");
                        System.out.println("8- Go back");
                        int y = keyboard.nextInt();
                        switch(y){
                            case 1:
                               String Info [][] = new String [50][4];
                               System.out.println("*Create a new account*");
                               for(int i=0;i<Info.length;i++ ){
                                System.out.println("Customer ID number :");
                               Info [i][0] = keyboard.next();
                               System.out.println("Customer Name :");
                               Info [i][1] = keyboard.next();
                               System.out.println("Customer password :");
                               Info [i][2] = keyboard.next();
                               System.out.println("Customer's phone number :");
                               Info [i][3] = keyboard.next();
                                break; }

                        //                               for(int i=0;i<Info.length;i++ ){
//                                   System.out.println(Info [i][0]);  
//                                      System.out.println(Info [i][1]);
//                                         System.out.println(Info [i][2]);
//                                            System.out.println(Info [i][3]);
//                                            }       
                                break;          
                              
                            case 2:
                                 System.out.println("*Deposit an amount in the account*");
                                 System.out.println("customer ID number :");
                                 String ID = keyboard.next();
                                 System.out.println("How much do you want to add ?");
                                 String add = keyboard.next();                                                                                                                                                                    
                                break;

كلمات دليلية: array code java

ساعد بالإجابة

"إن في قضاء حوائج الناس لذة لا يَعرفها إلا من جربها، فافعل الخير مهما استصغرته فإنك لا تدري أي حسنة تدخلك الجنة."

الإجابات (1)

Ahmed • منذ 4 سنوات

عمرو ، صعب جداً قراءة الـ code. اتمنى يتم تعديل السؤال واتباع التالي عند إلصاق الـ code لنتمكن من مساعدتك:

  • ضغط ادراج قصاصة

 

  • ضغط على تحديد اللـغة

 

  • تحديد لغة Java

 

  • إلصاق الـ code و الضغط على موافق. 

amro: شكرا اخي لقد حللت هذه المشكلة بالفعل ساضع سؤال اخر اريد المساعدة فيه

لايوجد لديك حساب في عالم البرمجة؟

تحب تنضم لعالم البرمجة؟ وتنشئ عالمك الخاص، تنشر المقالات، الدورات، تشارك المبرمجين وتساعد الآخرين، اشترك الآن بخطوات يسيرة !