|
Lab 9
Objective
To
understand and be able to use layout manager, use Try block, use catch block,
and throw exceptions
Classwork:
-
Define a class Customer that
has at least one data member balance, a constructor, and
getBalance function. It also has drawAmount
function, that throws
an InvalidAmountException
if the amount to be drawn not between 100 and 3000, inclusive, and
deposit function, that throws
an InvalidAmountException
also if the amount to be deposit less than 100. Create a class
InvalidAmountException with a default and a non-default
constructors to indicate to the user that he is attempting to draw or to
deposit an invalid amount. Write a driver program that has
InvalidAmountTest class with one object of type Customer to build
a GUI as shown in the figure below. The program also should handle a
NumberFormatException if the user entered a wrong data. Use
GridLayout to help you to arrange the components as shown.

|