Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You must write a public abstract class named BankAccount with fields and methods as defined below. BankAccount < > # accountID: String # interestRate:

imageimageimage

You must write a public abstract class named BankAccount with fields and methods as defined below. BankAccount < > # accountID: String # interestRate: double # currentBalance : int + credit(pennies: int): boolean + debit(pennies: int): boolean < > + getBalance() : int + getAccountID() : String + setAccountID(accountID: String) + getinterestRate() : double + setInterestRate (interestRate: double) + applyinterest() < > + accountInfo(): String < > UML CLass Diagram: BankAccount Structure of the Fields As described by the UML Class Diagram above, your BankAccount class must have the following fields: a protected field named accountID of type String, initialized to "0000-0000-0000-0000" a protected field named interestRate of type double, initialized to 0.0 a protected field named currentBalance of type int, initialized to 0 Structure of the Methods As described by the UML Class Diagram above, your BankAccount class must have the following methods: a public method named credit that takes an int argument and returns a boolean a public abstract method named debit that takes an int argument and returns a boolean a public method named getBalance that takes no arguments and returns an int a public method named getAccount ID that takes no arguments and returns an String Structure of the Methods As described by the UML Class Diagram above, your BankAccount class must have the following methods: a public method named credit that takes an int argument and returns a boolean a public abstract method named debit that takes an int argument and returns a boolean a public method named getBalance that takes no arguments and returns an int a public method named getAccount ID that takes no arguments and returns an String a public method named setAccount ID that takes a string argument and returns nothing a public method named getInterestRate that takes no arguments and returns a double a public method named setInterestRate that takes a double argument and returns nothing a public abstract method named apply Interest that takes no arguments and returns nothing a public abstract method named account Info that takes no arguments and returns a String Behavior of the Methods The credit method should add the argument amount to the currentBalance The debit method is abstract so there will be no behavior or method body The getBalance method should return the currentBalance The getAccountID method should return the accountID The setAccount ID method should store the argument value in the account ID field The getBalance method should return the currentBalance The getInterestRate method should return the interestRate The setInterestRate method should store the argument amount in the interestRate field The apply Interest method is abstract so there will be no behavior or method body The accountInfo method is abstract so there will be no behavior or method body Additional Information Since this is an abstract class, you will not be able to instantiate any object from it. You are given a TestAccount class that inherits\extends the BankAccount class. you may use this to help with testing your BankAccount class. Additional Information Since this is an abstract class, you will not be able to instantiate any object from it. You are given a TestAccount class that inherits\extends the BankAccount class. you may use this to help with testing your BankAccount class. You are also given a Main class whith a main method where you can write code to test your BankAccount class. All Bank Accounts 1. All accounts have balance, credit and debit amounts, and fees stored and passed as a number of pennies (int). 2. All debit amounts will be subtracted from the balance, and all credit amounts will be added to the balance. 3. All bank accounts have a non-negative interest rate (0.02 would be a 2% interest rate). 4. The credit method will always return true. Need Help? Additional help resources are available by clicking on the words "Need Help?" at the bottom of this page, and search for help or ask a question! Copyright 2021 Arizona State University - This content is protected and may not be shared, uploaded, sold, or distributed in whole or part. Copying any part of these instructions or any part of a solution and sharing online or otherwise in any form is a violation of copyright laws and the ASU Academic Integrity Policy. All violations will be prosecuted. 408928.2384696.qx3zqy7 LAB ACTIVITY 14.1.1: Bank Account (Individual Assignment) Downloadable files BankAccount.java TestAccount.java and Main.java Download Current file: BankAccount.java 0/100 Load default template...

Step by Step Solution

There are 3 Steps involved in it

Step: 1

java public abstract class BankAccount protected String accountI... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java An Introduction To Problem Solving And Programming

Authors: Walter Savitch

8th Edition

0134462033, 978-0134462035

More Books

Students also viewed these Programming questions