A8_ Java Syntax Lab
A8_ Java Syntax Lab
In this problem, you are given a phonebook having K (1<=K<=1000) entries. ith entry of the
phonebook will consist of two entities, name (Ni, 1<= |Ni|<=100) and phone number (Pi). Ni will
consist of English uppercase and lowercase letters along with spaces. Pi will consist of digits along
with a ‘+’ character in front. While giving input, users may give various problematic issues. For
example, during giving names Ni, users may give multiple spaces between the words of their names
along with trailing and leading spaces. You need to discard those multiple spaces and consider only
a single space in place of them. Also, the first letter of each would should be a capital letter and the
remaining letters should be small letters. Similarly, the country code (+880) might be missing in the
inputs for Pi, you need to add those as well. The stored format for each Pi, should be +880
d1d2d3d4d5–d6d7d8 d9d10d11. Here di means the ith digit. Observe the placement of characters properly,
along with spaces.
In this problem, you will be given a string S (containing only English alphabets, 1<=|S|<=100) as the
search string. You need to find all the entries that contain this string in any form (Upper or lower) in
the entry for Ni. For the matched entries, you need to print them as per the ascending order of Ni. It
means that, for any two entries (i and j), the entry with a lexicographically smaller value for the
name (Ni), should be printed before. During printing the matched entries, print the name (Ni) and
phone number (Pi) all single-spaced in the same line. Two output entries will follow one after
another in separate lines. Please see the input and output section for more details.
In the first line, you will be given the value of K. In the following 2 x K lines, you will be given the
information of the phonebook. In this group of entries, the first line will be the name (Ni) and the
following line will be (Pi). After these entries, you will get the value of S.
Constraints,
- You can not use built-in string-related specific functions (split, toUpperCase, toLowerCase,
equals, compareTo) to solve this problem. You can only use, size and charAt() function. It is expected
that, you would write everything from scratch here.
5 Aba Bbc Bcb +880 01344-576 789
01234576789
01344576789
h j ABA
+88001464576703
01334599789
aBa
6 Rar Wdmttt +880 06661-555 799
RaR wdMttt
06661555799
04688931265
05551311444
rrhmah ttthom
07771198611
tttkat EuroPe
+88002213141197
tTt
20 Ayphloaafdunedknqdmwxuvxkmda +880
04441-358 028
aYPHloAaFduneDkNQdMWxuvxKmda
Dunerrqminjdxehowetcoepsabuahnhnylbg
04441358028 hgbx +880 92220-482 102
89862611154 Mncqyorxxmziihiwuwwggumrfnukeuxzzw
vekyhwppbqsryocblxvemfdune +880
zzYdunexukWOmmjfrAxBJThINnimhTUnRp
89862-611 154
+88038679632402
Zzydunexukwommjfraxbjthinnimhtunrp
+880 38679-632 402
DUNErrqmiNJDXEHOWetCOePSabUaHnHNYlBgHgB
X
+88092220482102
DUNEwuj fFCqOkHlveMeSKEdeOrwgf
VOObQUMdkPWav
27412490386
oTTohsHZBVOPnkY
+88014933386575
OevevQiBFvMTScM
92203013020
gUzkPAuPThIbhqv
+88052139110571
uJOjxOVIdYnJPJo
+88007855377278
GLLTDLVLiXxzezq
93948895729
SWNHkbkEszYraNF
74769752928
QLATYwlBbAJxeHY
24404689083
wdZBUrj YAuNoTH
+88025915578098
tFXQ r MVeAXJYR
66906021513
bkukqhMaWOuHJxw
+88075359687086
xMxwWbukbqryolt
+88065654401233
JfrnzuMJEPkljGn
+88007271305190
BoIEpWcaafqrPRS
76294928970
wmXpnLlCIUfUmsk
66108302375
LoNyPtqwqSXEkuY
18731193392
DuNe
Submission:
During submission, submit only one single Java file. The Main class's name should be, Problem_X
where X denotes your roll number. Please do not participate in any sort of unexpected act
(Plagiarism/copy, etc.). This will lead to severe penalties. Alongside this, please maintain the
submission format. I intend to check each submission by giving inputs. So, if you do not maintain
the rules properly, your submission will not be properly evaluated. Best of luck.