|
| 1 | +/* |
| 2 | + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| 3 | + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| 4 | + */ |
| 5 | +package com.mycompany.bank; |
| 6 | + |
| 7 | +/** |
| 8 | + * |
| 9 | + * @author Abdulrhman |
| 10 | + */ |
| 11 | + import java.util.*; |
| 12 | +class services { |
| 13 | + int accnum; |
| 14 | + String name; |
| 15 | + String acctype; |
| 16 | + int Birthday; |
| 17 | + int Password; |
| 18 | + long balanceAmount; |
| 19 | + long balanceAmount1; |
| 20 | + long balanceAmount2; |
| 21 | + long balancedep; |
| 22 | + long balanceAmountwith; |
| 23 | + long invest; |
| 24 | + int id; |
| 25 | + long with; |
| 26 | + |
| 27 | + Scanner input = new Scanner(System.in); |
| 28 | + |
| 29 | + public void newAccount() { |
| 30 | +System.out.print("Please Fill ur personal information carefully \n"); |
| 31 | + System.out.print("Enter Your Account id: "); |
| 32 | + accnum = input.nextInt(); |
| 33 | + System.out.print("Enter your FullName: "); |
| 34 | + name = input.nextLine(); |
| 35 | + System.out.print("Account type (personal or company): "); |
| 36 | + acctype = input.nextLine(); |
| 37 | + System.out.print("Enter Birthday: "); |
| 38 | + Birthday = input.nextInt(); |
| 39 | + System.out.print("Enter Password: "); |
| 40 | + Password = input.nextInt(); |
| 41 | + System.out.print("Enter Your Balance: "); |
| 42 | + balanceAmount = input.nextLong(); |
| 43 | + |
| 44 | + } |
| 45 | + |
| 46 | + public void showAccounts() { |
| 47 | + System.out.print("All Accounts :"); |
| 48 | + System.out.println("Name : ahmed \n Birthday : 2002/12/2 \n Account id : 65281627 \n Account tpye: personal \n balance : 7531$ \n "); |
| 49 | + System.out.println("--------------------------------------------------------"); |
| 50 | + System.out.println("Name : akram \n Birthday : 1990/1/21 \n Account id : 97642340 \n Account tpye: personal \n balance : 12900$ \n "); |
| 51 | + System.out.println("--------------------------------------------------------"); |
| 52 | + System.out.println("Name : ali \n Birthday : 1985/4/2 \n Account id : 3090012 \n Account tpye: company \n balance : 4309888$ \n "); |
| 53 | + System.out.println("--------------------------------------------------------"); |
| 54 | + System.out.println(" Your FullName is: " + name); |
| 55 | + System.out.println("Your Account id is: " + accnum); |
| 56 | + System.out.println(" Your Birthday is: " + Birthday ); |
| 57 | + System.out.println("Your Account Type is: " + acctype); |
| 58 | + balanceAmount = balanceAmount + balancedep - balanceAmountwith ; |
| 59 | + System.out.println("Your Balance is: " + balanceAmount ); |
| 60 | + } |
| 61 | + |
| 62 | + public void depositAccount() { |
| 63 | + long amount; |
| 64 | + System.out.println("Be Carefull to put your correct id." ); |
| 65 | + System.out.println("Enter Your Account id :"); |
| 66 | + id = input.nextInt(); |
| 67 | + if (id == accnum ) { |
| 68 | + System.out.println("Enter the account you want to deposit:"); |
| 69 | + amount = input.nextLong(); |
| 70 | + balancedep = amount + balancedep; |
| 71 | + System.out.println("Successfully Deposit " + " " + " Your Balance is" + " " + balancedep); |
| 72 | + }else { |
| 73 | + System.out.println("There are no account" + " " +id); |
| 74 | + }} |
| 75 | + |
| 76 | + public void withdrawMoney() { |
| 77 | + |
| 78 | + long amount1; |
| 79 | + System.out.println("Enter the withdraw amount:"); |
| 80 | + amount1 = input.nextLong(); |
| 81 | + if (amount1 >= balanceAmountwith) { |
| 82 | + balanceAmountwith = balanceAmount - amount1; |
| 83 | + System.out.println(" Transaction Successfully "); |
| 84 | +// |
| 85 | + } else { |
| 86 | + System.out.println("You balance is less than the amount" + "\n Failed to withdraw"); |
| 87 | + } |
| 88 | + } |
| 89 | + public void other_servicess(){ |
| 90 | + System.out.println("We have other services which are \n 1 invest \n 2 Book your hotel "); |
| 91 | + int inv = input.nextInt(); |
| 92 | + if (inv == 1) { |
| 93 | + System.out.println("you choose to invest"); |
| 94 | + System.out.println("Enter the amount you want to invest with"); |
| 95 | + invest = input.nextLong(); |
| 96 | + if (invest < balanceAmount) { |
| 97 | + System.out.println(" INVESTMENT Successfully "); |
| 98 | + } else { |
| 99 | + System.out.println("You dont have enogh money"); |
| 100 | + } |
| 101 | + } |
| 102 | + if(inv == 2){ |
| 103 | + int book; |
| 104 | + System.out.println("Choose any of those hotels to book to: \n 1. ADENHOTEL \n 2. Sanaahotel \n 3. Taizhotel"); |
| 105 | + book = input.nextInt(); |
| 106 | + System.out.print("You choose : " + " " + book); |
| 107 | + |
| 108 | + } |
| 109 | + |
| 110 | +} |
| 111 | +} |
| 112 | + |
| 113 | + |
0 commit comments