-
Notifications
You must be signed in to change notification settings - Fork 0
/
problem1.java
38 lines (28 loc) · 1.1 KB
/
problem1.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import java.util.Hashtable;
import java.util.Scanner;
// almost complete only set ignore case sensitive in the key
public class problem1 {
public void search4keyWord(Hashtable<String , PakUni> uni ){
Scanner sc = new Scanner(System.in);
String key;
System.out.println("Enter 4 Keys words ");
key = sc.nextLine();
while (key.length()!=4) {
System.out.println("the key contain 4 word try again ");
key = sc.nextLine();
}
if(uni.containsKey(key.toUpperCase()) && key.length()==4 ){
PakUni value = uni.get(key.toUpperCase());
System.out.println("Uni_Name : "+value.getName() );
System.out.println("Word Ranking : "+value.getWord_rank() );
System.out.println("Asia Ranking : "+value.Asia_rank );
System.out.println("Pakistan Ranking : "+value.getPak_rank() );
System.out.println("Address : "+value.getaddress() );
System.out.println("Publication : "+value.getNum_of_publish() );
}
else{
System.out.println("Data not contain in the hash table");
}
sc.close();
}
}