JAVA CODE
// Date program import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class Date extends Applet implements ActionListener { Label Prompt, Prompt1, Prompt2; TextField DayText, MonthText, YearText; int Day, Month, Year; public void init() { Prompt = new Label (" Enter day "); add(Prompt); DayText = new TextField(3); add(DayText); DayText.addActionListener(this); Prompt1 = new Label (" Enter month "); add(Prompt1); MonthText = new TextField(3); add(MonthText); MonthText.addActionListener(this); Prompt2 = new Label (" Enter year "); add(Prompt2); YearText = new TextField(3); add(YearText); YearText.addActionListener(this); } public void paint( Graphics g ) { if (Day < 1) { g.drawString("The day can't be zerro or negative value", 30, 80); g.drawString("Please try again", 30, 100); } else if (Day > 31) { g.drawString("It day can't larger than 31", 30, 80); g.drawString("Please try again", 30, 100); } else if (Month == 1) g.drawString("The date is " + Day + " Jan " + Year, 30, 80 ); else if (Month == 2) g.drawString("The date is " + Day + " Feb " + Year, 30, 80 ); else if (Month == 3) g.drawString("The date is " + Day + " Mar " + Year, 30, 80 ); else if (Month == 4) g.drawString("The date is " + Day + " Apr " + Year, 30, 80 ); else if (Month == 5) g.drawString("The date is " + Day + " May " + Year, 30, 80 ); else if (Month == 6) g.drawString("The date is " + Day + " Jun " + Year, 30, 80 ); else if (Month == 7) g.drawString("The date is " + Day + " Jul " + Year, 30, 80 ); else if (Month == 8) g.drawString("The date is " + Day + " Aug " + Year, 30, 80 ); else if (Month == 9) g.drawString("The date is " + Day + " Sept " + Year, 30, 80 ); else if (Month == 10) g.drawString("The date is " + Day + " Oct " + Year, 30, 80 ); else if (Month == 11) g.drawString("The date is " + Day + " Nov " + Year, 30, 80 ); else if (Month == 12) g.drawString("The date is " + Day + " Dec " + Year, 30, 80 ); else g.drawString("The month can't smaller than 1 or larger than 12", 30, 80 ); } public void actionPerformed ( ActionEvent e ) { Day = Integer.valueOf(DayText.getText()).intValue(); Month = Integer.valueOf(MonthText.getText()).intValue(); Year = Integer.valueOf(YearText.getText()).intValue(); repaint(); } }