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.
Joined: Sep 27, 2002
If this is your project work, please complete it yourself. The bartenders are quite strict with such posts here!