import javax.swing.*; import java.awt.*; import java.awt.event.*; /** * Zeller GUI * Implements Zeller Congruence for calculating day of week * * @author your-name-goes-here (your-e-mail-address) */ public class ZellerGUI extends JFrame implements ActionListener { private int dayOfWeek; // GUI text fields for month, day and year private JTextField txtMonth = new JTextField("",10); // Add JTextfield declarations for txtDay and txtYear here .. private JTextField txtDayOfWeek = new JTextField("",10); // Labels for the text fields private JLabel lblMonth = new JLabel("Month"); private JLabel lblOutDay = new JLabel("Day of Week"); // Add Label declarations for lblDay and lblYear here ... private JButton btnCompute = new JButton ("Compute"); public ZellerGUI() { setTitle("Zeller Congruence"); setLocation(200, 200); setSize(200, 300); Container c = getContentPane(); c.setBackground(Color.white); c.setForeground(Color.black); c.setLayout(new FlowLayout()); c.add(lblMonth); c.add(txtMonth); // Add labels and text boxes for Day and Year c.add(lblOutDay); c.add(txtDayOfWeek); c.add(btnCompute); btnCompute.addActionListener(this); setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true); } public static void main(String args[]) { new ZellerGUI(); } public void actionPerformed(ActionEvent event) { int month = Integer.parseInt(txtMonth.getText()); // Add a statement (like the preceding) to getText() from your // day text field int day = 1; //Add a statement to getText() from your year text field int year = 2000; computeDayOfWeek(month,day,year); txtDayOfWeek.setText(""+dayOfWeek); } private void computeDayOfWeek(int month, int day, int year) { // Insert your Zeller code here System.out.println(""+dayOfWeek); //use println for debugging } }