Skip to content

Commit 1cc1168

Browse files
authored
Add files via upload
1 parent c3c8b83 commit 1cc1168

File tree

7 files changed

+182
-0
lines changed

7 files changed

+182
-0
lines changed

bank/pom.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>com.mycompany</groupId>
5+
<artifactId>bank</artifactId>
6+
<version>1.0-SNAPSHOT</version>
7+
<properties>
8+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
9+
<maven.compiler.source>17</maven.compiler.source>
10+
<maven.compiler.target>17</maven.compiler.target>
11+
<exec.mainClass>com.mycompany.bank.Bank</exec.mainClass>
12+
</properties>
13+
</project>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3+
* Click nbfs://nbhost/SystemFileSystem/Templates/Project/Maven2/JavaApp/src/main/java/${packagePath}/${mainClassName}.java to edit this template
4+
*/
5+
6+
package com.mycompany.bank;
7+
8+
/**
9+
*
10+
* @author Abdulrhman
11+
*/
12+
import java.util.Scanner;
13+
14+
15+
public class Bank extends services {
16+
17+
public static void main(String[] args) {
18+
19+
20+
System.out.println("Enter your choice: ");
21+
22+
Scanner input = new Scanner(System.in);
23+
24+
services mybank = new services();
25+
26+
do{
27+
System.out.println( "1. Create a new account\n 2. Display all account details\n 3. Deposit the amount \n 4. Withdraw the amount \n 5. other servicess ");
28+
int a = input.nextInt();
29+
switch(a){
30+
31+
case 1:{
32+
mybank.newAccount();
33+
break;
34+
}
35+
case 2:{
36+
mybank.showAccounts();
37+
break;
38+
}
39+
case 3:{
40+
mybank.depositAccount();
41+
break;
42+
}
43+
case 4:{
44+
mybank.withdrawMoney();
45+
break;
46+
}
47+
case 5:{
48+
mybank.other_servicess();
49+
} }
50+
51+
}while (true);
52+
}
53+
}
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
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+
1.57 KB
Binary file not shown.
4.19 KB
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
com\mycompany\bank\services.class
2+
com\mycompany\bank\Bank.class
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
C:\Users\Abdulrhman\OneDrive\Documents\NetBeansProjects\bank\src\main\java\com\mycompany\bank\Bank.java

0 commit comments

Comments
 (0)