write a java program to chaeck whether the number entered by the user is a single digit number, a teo digit number or three digits number display the message accordingly
Answers
Explanation:
statements for inputing number
if length of numbers is 1 or 2 or 3 accordingly you print the message
Answer:
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
class AlertService {
private final MapAlertDAO storage = new MapAlertDAO();
public UUID raiseAlert() {
return this.storage.addAlert(new Date());
}
public Date getAlertTime(UUID id) {
return this.storage.getAlert(id);
}
}
class MapAlertDAO {
private final Map<UUID, Date> alerts = new HashMap<UUID, Date>();
public UUID addAlert(Date time) {
UUID id = UUID.randomUUID();
this.alerts.put(id, time);
return id;
}
public Date getAlert(UUID id) {
return this.alerts.get(id);
}
}