Skip to content

Commit b166bef

Browse files
Create 28.1 Bank AC Opeer.java
1 parent 5c42fcb commit b166bef

File tree

1 file changed

+111
-0
lines changed

1 file changed

+111
-0
lines changed

28.1 Bank AC Opeer.java

+111
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/*
2+
Jalandhar Public Bank has recently launched the Provident Fund Scheme and the CEO of the bank is looking for a java program to create a Provident Fund object such that customer should be allowed to open the account by providing any one of the id proofs Aadhar (long) or PAN (String) along with Full Name. It is also expected that the unique account number is assigned to the Customer in a serial order starting from A101 for Aadhar Card holders and P101 for PAN holders.
3+
4+
Input Format
5+
6+
First line reads the number of accounts to be opened N
7+
N times,
8+
Read the Name of the Customer
9+
read the character (A/ P)
10+
read the Aadhar Number of PAN accordingly
11+
12+
Constraints
13+
14+
N>0
15+
16+
Output Format
17+
18+
Prints the Account Numbers in separate lines
19+
20+
Sample Input 0
21+
22+
2
23+
Amit Dutta
24+
P
25+
DUAPS7896P
26+
Sanjeev
27+
A
28+
512233213490
29+
Sample Output 0
30+
31+
P101
32+
A101
33+
Sample Input 1
34+
35+
2
36+
Md. Azharuddin
37+
A
38+
GHBRQ2718A
39+
Surinder Singh
40+
A
41+
MPUPS3878D
42+
Sample Output 1
43+
44+
A101
45+
A102
46+
*/
47+
48+
import java.io.*;
49+
import java.util.*;
50+
51+
class JPB
52+
{
53+
54+
String name;
55+
String PAN;
56+
String Aadhar;
57+
String CN;
58+
static int ACN = 101;
59+
static int PCN = 101;
60+
JPB(String name)
61+
{
62+
this.name = name;
63+
}
64+
void getOpenA(String A)
65+
{
66+
Aadhar = A;
67+
CN = "A"+Integer.toString(ACN++);
68+
}
69+
void getOpenP(String P)
70+
{
71+
PAN = P;
72+
CN = "P"+Integer.toString(PCN++);
73+
}
74+
75+
76+
}
77+
public class Solution {
78+
79+
public static void main(String[] args) {
80+
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
81+
82+
Scanner sc = new Scanner(System.in);
83+
int n = sc.nextInt();
84+
sc.nextLine();
85+
String name;
86+
char c;
87+
JPB [] j = new JPB[n];
88+
for(int i=0;i<n;i++)
89+
{
90+
if(i!=0)
91+
sc.nextLine();
92+
name = sc.nextLine();
93+
c = sc.next().charAt(0);
94+
if(c=='A')
95+
{
96+
String adh = sc.next();
97+
j[i] = new JPB(name);
98+
j[i].getOpenA(adh);
99+
System.out.println(j[i].CN);
100+
}
101+
else if(c=='P')
102+
{
103+
String pan = sc.next();
104+
j[i] = new JPB(name);
105+
j[i].getOpenP(pan);
106+
System.out.println(j[i].CN);
107+
}
108+
}
109+
110+
}
111+
}

0 commit comments

Comments
 (0)