Académique Documents
Professionnel Documents
Culture Documents
Lab 5
Exercise 1
a. Read and analyze the program below
/**
Introduction to OOP with Java 4th Ed, McGraw-Hill by Wu/Otani
extended by Zulaile Mabni
A Sample frame to illustrate the placing of GUI objects and event
handling with Swing JFrame
**/
import
import
import
import
javax.swing.*;
java.awt.*;
java.awt.event.*;
java.io.*;
{
}
System.exit(0);
}
// end of ActionPerformed method
}
Program 1.1
b. What is the output? (Draw the GUI in the box below)
Exercise 2
Raya Biscuit Sdn. Bhd. Has requested from you to write a GUI program to calculate the
total price to be paid by the customer for the biscuits that they purchased. Write a JAVA
program to develop the GUI interface as shown below. Use GridLayout(6,2).
In order for us to calculate the total price to be paid by the customers for the biscuits that
they purchased, we need to do some calculation using the event handling mechanism.
Each customer can make order based on the following information:
Types
Almond London
Mazola Cookies
Write the event handler for this system to calculate the total price based on the types
and quantity of biscuits ordered by the customers. Additional RM5.00 delivery charges
will be charged for customers who need the delivery services.