. Write an interactive program which prompts the user with the following
options on the opening menu:
1) Student Information
2) Course Material Despatch Status
3) Fee Status (Paid or Due for Payment)
4) Time Table for Theory Counselling
5) Time Table for Practical Counselling
6) Assignment Submission Schedules
7) Change of the Correspondence Address
8) General Queries
9) Quit
(40 Marks)
Answers
Program for the given question in java language:
import java.awt.event.*;
public class MenuProg extends Frame implements ActionListener
{
Menu open;
public MenuProg ()
{
MenuBar mb = new MenuBar(); // begin with creating menu bar
setMenuBar(mb); // add menu bar to frame
open= new Menu("Open"); // create menus
mb.add(open); // add menus to menu bar
open.addActionListener(this); // link with ActionListener for event handling
open.add(new MenuItem("Student Information"));
open.add(new MenuItem("Course Material Despatch Status"));
open.add(new MenuItem("Fee Status (Paid or Due for Payment)"));
open.add(new MenuItem("Time Table for Theory Counselling"));
open.add(new MenuItem("Time Table for Practical Counselling"));
open.add(new MenuItem("Assignment Submission Schedules"));
open.add(new MenuItem("Change of the Correspondence Address"));
open.add(new MenuItem("General Queries"));
open.add(new MenuItem("Quit"));
setTitle("Menu Program"); // frame creation methods
setSize(300, 300);
setVisible(true);
}
public void actionPerformed(ActionEvent event)
{
String string = event.getActionCommand(); // know the menu item selected by the user
System.out.println("You selected " + string);
}
public static void main(String args[])
{
new MenuProgram();
}
}