This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
i cant seem to make the right main method! and the exceptions. im still new to this.
1. Create a class named Account with the following data members
>name of type String >balance of type double
>accountNo of type String
Encapsulate Fields and provide Setters and Getters for the data members.
Provide the following methods for the Account Class
>public void deposit(double amount)
- increases the balance by the amount
>public void withdraw(double amount)
- decreases the balance by the amount
Create a CreditCard class that inherits the Account class.
Provide a constructor for the CreditCard class that initializes the Name of the cardholder, account number, card number, credit_limit, credit balance, expiry_date, and balance. It is assumed that the cardholder initially does not have debts yet.
CreditCard class must contain the following data members: --
2 credit_limit of type double
3 credit_balance of type double
4 card_number of type long
5 expiry_date of type String
6 public void cashAdvance ( float amount )
- must throw ” ExceedsCashAdvanceLimitException “ if the amount exceeds 30% of the credit limit, otherwise the credit balance will increase by amount (if account balance is zero).
- must throw “InsufficientBalanceException” if the amount does not exceed 30% of the credit limit but will exceed the credit limit after the credit balance is increased by amount.
- charges a fixed additional amount of 300.00 for every cash advance made by the card owner.
7 public void deposit (float amount);
- decreases the credit balance by amount and if amount exceeds the credit balance then account balance increases by amount or maybe a fraction of the amount depending on the excess over credit balance.
8 public void balanceInquiry ();
- displays the credit limit and the credit balance.
9 public void swipe (float amount)
- must throw “InsufficientBalanceException” if credit balance, increased by amount, will exceed the credit limit.