thank you all for help.

Regards,
Deepak
On Oct 17, 2013 4:52 PM, "yodex" <[email protected]> wrote:

> Hi,
> Here is the solution :
>
> public class HMapProblem {
>  private static Map<String,Integer> students = new HashMap<String,
> Integer>();
>  static{
> students.put("A", 88);
> students.put("B", 34);
> students.put("C", 53);
> students.put("D", 12);
> students.put("E", 44);
> students.put("F", 56);
> students.put("G", 78);
> students.put("H", 87);
> students.put("I", 54);
>  }
>  protected static Map<String,Integer> getStudents(Integer begin, Integer
> end){
>  Map<String,Integer> requestedStudents = new HashMap<String, Integer>();
>  for(Entry<String, Integer> student : students.entrySet()){
> if(student.getValue()>=begin && student.getValue()<=end){
> requestedStudents.put(student.getKey(), student.getValue());
> }
> }
>  return requestedStudents;
> }
>  public static void main(String[] args) {
>  Map<String,Integer> result = HMapProblem.getStudents(50, 87);
>  System.out.println(result);
> }
> }
>
> среда, 16 октября 2013 г., 12:30:47 UTC-4 пользователь Deepak A L написал:
>>
>> hi,
>>
>> I'm facing problem with the Hashmap,
>>
>> can you please help on this ?
>>
>> HashMap:
>>
>> Key= collection of Student Names(A,B,C,D,E,F,G,H,I)
>>
>> Values= Marks (88,34,53,12,44,56,78,87,54)
>>
>> Can you help me with java code to get all the Students who have marks
>> between 50 to 87?
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"JPassion.com: Java Programming" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at http://groups.google.com/group/jpassion_java.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to