Answered step by step
Verified Expert Solution
Question
1 Approved Answer
JAVA PROBLEM Here is the copied and pasted code so its easy to copy: package coll.UserAccounts ; public class BankAccount { /** * Constructs a
JAVA PROBLEM
Here is the copied and pasted code so its easy to copy:
package coll.UserAccounts; public class BankAccount { /** * Constructs a bank object with $0.0 funds and assigns the given User as the * owner. * @param owner */ public BankAccount(User owner) { } /** * Gets the total funds in the account. * @return */ public double getFunds() { return 0; } /** * Deposits money into the account. * @param deposit. The sum of money in $ to be deposited. */ public void deposit(double deposit) { } /** * Withdraws money from the account. Only the owner can withdraw funds. * @param user. The user attempting to withdraw funds. * @param withdrawal. The amount to be withdrawn. * @throws UserException if anyone but the owner is attempting to withdraw fundss. * @throws FundsException if there are insufficient funds in the account. */ public void withdraw(User user, double withdrawal) throws UserException, FundsException { } }
package coll.UserAccounts; public class FundsException extends Exception { }
package coll.UserAccounts; /** * Exists as a primitive front-end for the User and BankAccount classes. */ public class GUI { /** * Transfers money from one account to another. If the withdraw fails due to a * UserException then print "Unauthorized access!" If the withdraw fails due to * a FundsException then print "Insufficient funds!" * * @param user. The user that is attempting to execute the transfer. * @param b1. The bank account that the funds are being transferred from. * @param b2. The bank account that the funds are being transferred to. * @param amount. The amount of money to be transferred in $. */ public static void transfer(User user, BankAccount b1, BankAccount b2, double amount) { } }
package coll.UserAccounts; public class User { /** * Constructs a user with a given username and password. If a user is * successfully constructed, their username is added to the list of usernames. * * @param username * @param password * @throws Exception. * Throws a UserException if the username or password is invalid * (use the below methods badUsername and badPassword to assist you * with this). */ public User(String username, String password) throws Exception { } /** * Gets the username of the user. * * @return */ public String getUsername() { return null; } /** * Gets the password of the user. * * @return */ public String getPassword() { return null; } /** * Checks if a given username is invalid * * @param username * @return true if the username already exist, false otherwise. */ public static boolean badUsername(String username) { return false; } /** * Checks if a given password is invalid. * * @param password * @return true if the password is fewer than 8 characters long, false * otherwise. */ public static boolean badPassword(String password) { return false; } }
package coll.UserAccounts; public class UserException extends Exception { }Requirements Your task is to develop a simple online banking system. There are: Two exceptions classes: UserException FundsException Two backend classes: User BankAccount One frontend class: GUI UserException and FundsException both subclass Exception, and Your task is to complete User, BankAccount, and GUI by using object-oriented programming, and exception throwing& handling. You will need to create a static ArrayList
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started