6) Using Class implement Hash table to 1) Accept ‘n’ records of students (Name, Percentage) 2) Display details of all students 3)Find out highest marks .

import java.util.*;
import java.io.*;
class HTDemo
public static void main(String args[]) throws IOException
String str;
Hashtable<String,Integer> stud = new Hashtable<String,Integer>();
Enumeration<String> names;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println(“Enter How many Records “);
int n=Integer.parseInt(br.readLine());

for (int i=1;i<=n;i++)
System.out.println(“Enter Name Of “+ i+” Student”);
System.out.println(“Enter Marks Of “+ i+” Student”);
int marks=Integer.parseInt(br.readLine());
stud.put(str, marks);

int maxmarks=0;
names = stud.keys();

str = (String) names.nextElement();
System.out.println(str + “: ” + stud.get(str));

System.out.println(” Maximum Marks Is “+maxmarks);


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s