304311 Java Lab 

Lab 9

Objective

To understand and be able to use layout manager, use Try block, use catch block, and throw exceptions

Classwork:

  1. 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.

 

 

 

 

 

 

 

 

 

 

 

Lab 1
Lab 2
Lab 3
Lab 4
Lab 5
Lab 6
Lab 7
Lab 8
Lab 9

 � All Copyright Reserved By Fatma & Tahany,Email : [email protected]

Hosted by www.Geocities.ws

1