Lab 06
Lab 06
You are developing a basic banking application that allows users to withdraw funds from their
accounts. The application should properly manage exceptions using the throws keyword.
Implement the following specifications:
1. Account Class:
o Create a class named Account with these attributes:
▪ accountNumber (String)
▪ balance (double)
o Include a constructor to initialize both the account number and balance.
2. Withdraw Method:
o Implement a method withdraw(double amount) that:
▪ Throws an IllegalArgumentException if the amount to withdraw
exceeds the current balance.
▪ Throws another IllegalArgumentException if the amount is negative.
3. Main Class:
o In your main class, create an instance of Account.
o Prompt the user for the amount they wish to withdraw.
o Use a try-catch block to call the withdraw method and handle the exceptions.
o Print appropriate messages based on the exceptions that are caught
Task 2
Create a class Character with attributes for name, class type, and level.
Implement a method createCharacter(String name, String classType, int level)
that: