GIVE ME A SOLUTION
package com.codegym.task.task08.task0816;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
//import java.util.SimpleDateFormat;
import java.util.HashMap;
import java.util.Locale;
//import java.util.LocalDate;
import java.util.Map;
/*
Kind Emma and the summer holidays
*/
public class Solution {
public static HashMap<String, Date> createMap() throws ParseException {
DateFormat df = new SimpleDateFormat("MMMMM d yyyy", Locale.ENGLISH);
HashMap<String, Date> map = new HashMap<String, Date>();
map.put("1", df.parse("JUNE 1 1980"));
map.put("2", df.parse("JULY 1 1980"));
map.put("3", df.parse("AUGUST 1 1980"));
map.put("4", df.parse("SEPTEMBER 1 1980"));
map.put("5", df.parse("DECEMBER 1 1980"));
map.put("6", df.parse("JUNE 18 1980"));
map.put("7", df.parse("JANUARY 1 1980"));
map.put("8", df.parse("JUNE 12 1988"));
map.put("9", df.parse("DECEMBER 11 1980"));
map.put("10", df.parse("JUNE 24 1980"));
return map;
}
public static void removeAllSummerPeople(HashMap<String, Date> map) {
//DateFormat df = new SimpleDateFormat("MMMM d", Locale.ENGLISH);
//Date startDate = df.parse("JUNE 1");
//Date endDate = df.parse("AUGUST 31");
//LocalDate currentDate = LocalDate.now();
int s1 = 6;
int s2 = 7;
int s3 = 8;
for(Map.Entry<String, Date> pair : map.entrySet()){
Date date = pair.getValue();
SimpleDateFormat dateFormat = new SimpleDateFormat("MM");
int month = Integer.parseInt(dateFormat.format(date));
if(s1==month||s2==month||s3==month){
map.remove(pair.getKey());
}
//System.out.println(month);
}
}
public static void main(String[] args) {
}
}