1. Implement the CheckingAccount.java based on the UML below. CheckingAccount is a subclass of BankAccount. A...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. Implement the CheckingAccount.java based on the UML below. CheckingAccount is a subclass of BankAccount. A checking account has a transaction fee that is associated with all deposits and withdrawals. 2. Download BankAccount.java. BankAccount is the super class of CheckingAccount You are NOT allowed to change the BankAccount class code in any way, with one exception: you can change all member/instance variables from private to protected. 3. Download Bank.java. This is the tester class. Make the following changes to create and manipulate Checking Account objects: 4. ● ● Change the studentAccount object to a CheckingAccount object Modify the switch statement to add the ability to set the transaction fee. Make sure that you do not allow negative values. Adjust the function displayMenu() accordingly. Submit BankAccount.java and CheckingAccount.java, and Bank.java. Include output at the bottom of Bank.java -transaction Fee: double +CheckingAccount() +getTransactionFee(): double +deposit(amount : double): void +setTransaction Fee(trFee: double): void // sets instance variable transaction Fee +withdraw(amount : double): void CheckingAccount +toString(): String //all transactions (deposits and withdrawals) get charged this fee //constructor. Must call the super class constructor to initialize acctNumber to 0, name to Unknown , balance to 0.0. Then initialize transactionFee to 1.00. //returns the value of instance variable transactionFee lladds the amount to the balance and subtracts the transaction Fee from the balance //subtracts the amount from the balance and subtracts the transactionFee from the balance //displays the current values of all instance variables of a checking account. Must use toString() from the super class. Design Notes: Create the CheckingAccount child class in file CheckingAccount.java A child class is also called a subclass or a derived class. Make sure they are in the same package. ● Create a CheckingAccount constructor. The CheckingAccount constructor will call the corresponding superclass constructor. Remember it will be the very first statement. You will also need to initialize transactionFee in the constructor. Here is example code for the CheckingAccount constructor. In this example you see that a call is made to the BankAccount constructor. This initializes the member variables defined in BankAccount. Then the member variable transaction Fee is initialized. ● ● ● Public CheckingAccount () { // constructor first calls the BankAccount constructor using //the keyword super then initializes transaction Fee } } Super (); transaction Fee = 1.00; Add the accessor/get and mutator/set functions for transactionFee. Create deposit and withdraw methods in CheckingAccount. Since there is a fee associated with all deposits and withdrawals in a checking account, you will need to create deposit and withdraw methods in Checking Account. These methods will override the deposit and withdraw methods in BankAccount. Make sure that the member variables in your super class have been set to protected rather than private. Add a toString method. This function overrides the tostring method in BankAccount. Here is an example of possible code. public String toString() //call the toString method from BankAccount and then concatanate it with the intance variable of CheckingAccount to form the resultant String to retrun Example of expected output: Example of expected output: Welcome to your bank. 1. Make a deposit. 2. Make a withdrawal 3. Set the account name 4. Set the account number. 5. Set the transaction fee 6. Display account information 7. Exit Please enter your choice: 6 Account Information Number: Name: Balance: Transaction Fee: Ch 8 Program 1- BankAccount 1. Make a deposit. 2. Make a withdrawal Welcome to your bank Unknown 0.00 1.00 3. Set the account name 4. Set the account number 0 5. Set the transaction fee 6. Display account information 7. Exit Please enter your choice: 1 Deposit amount. Enter value: -50 Enter value: (0 or greater): 50 Welcome to your bank Welcome to your bank 1. Make a deposit 2. Make a withdrawal 3. Set the account name 4. Set the account number 5. Set the transaction fee 6. Display account information 7. Exit Please enter your choice: 3 Enter the name: Joe Smith Welcome to your bank 1. Make a deposit 2. Make a withdrawal 3. Set the account name 4. Set the account number. 5. Set the transaction fee 6. Display account information 7. Exit Please enter your choice: 4 Account number. Enter value: 23456 Welcome to your bank 1. Make a deposit 2. Make a withdrawal 3. Set the account name 4. Set the account number 5. Set the transaction fee 6. Display account information 7. Exit Please enter your choice: 6 Account Information Number: Name: Balance: Transaction Fee: 23456 Joe Smith 49.00 1.00 1. Implement the CheckingAccount.java based on the UML below. CheckingAccount is a subclass of BankAccount. A checking account has a transaction fee that is associated with all deposits and withdrawals. 2. Download BankAccount.java. BankAccount is the super class of CheckingAccount You are NOT allowed to change the BankAccount class code in any way, with one exception: you can change all member/instance variables from private to protected. 3. Download Bank.java. This is the tester class. Make the following changes to create and manipulate Checking Account objects: 4. ● ● Change the studentAccount object to a CheckingAccount object Modify the switch statement to add the ability to set the transaction fee. Make sure that you do not allow negative values. Adjust the function displayMenu() accordingly. Submit BankAccount.java and CheckingAccount.java, and Bank.java. Include output at the bottom of Bank.java -transaction Fee: double +CheckingAccount() +getTransactionFee(): double +deposit(amount : double): void +setTransaction Fee(trFee: double): void // sets instance variable transaction Fee +withdraw(amount : double): void CheckingAccount +toString(): String //all transactions (deposits and withdrawals) get charged this fee //constructor. Must call the super class constructor to initialize acctNumber to 0, name to Unknown , balance to 0.0. Then initialize transactionFee to 1.00. //returns the value of instance variable transactionFee lladds the amount to the balance and subtracts the transaction Fee from the balance //subtracts the amount from the balance and subtracts the transactionFee from the balance //displays the current values of all instance variables of a checking account. Must use toString() from the super class. Design Notes: Create the CheckingAccount child class in file CheckingAccount.java A child class is also called a subclass or a derived class. Make sure they are in the same package. ● Create a CheckingAccount constructor. The CheckingAccount constructor will call the corresponding superclass constructor. Remember it will be the very first statement. You will also need to initialize transactionFee in the constructor. Here is example code for the CheckingAccount constructor. In this example you see that a call is made to the BankAccount constructor. This initializes the member variables defined in BankAccount. Then the member variable transaction Fee is initialized. ● ● ● Public CheckingAccount () { // constructor first calls the BankAccount constructor using //the keyword super then initializes transaction Fee } } Super (); transaction Fee = 1.00; Add the accessor/get and mutator/set functions for transactionFee. Create deposit and withdraw methods in CheckingAccount. Since there is a fee associated with all deposits and withdrawals in a checking account, you will need to create deposit and withdraw methods in Checking Account. These methods will override the deposit and withdraw methods in BankAccount. Make sure that the member variables in your super class have been set to protected rather than private. Add a toString method. This function overrides the tostring method in BankAccount. Here is an example of possible code. public String toString() //call the toString method from BankAccount and then concatanate it with the intance variable of CheckingAccount to form the resultant String to retrun Example of expected output: Example of expected output: Welcome to your bank. 1. Make a deposit. 2. Make a withdrawal 3. Set the account name 4. Set the account number. 5. Set the transaction fee 6. Display account information 7. Exit Please enter your choice: 6 Account Information Number: Name: Balance: Transaction Fee: Ch 8 Program 1- BankAccount 1. Make a deposit. 2. Make a withdrawal Welcome to your bank Unknown 0.00 1.00 3. Set the account name 4. Set the account number 0 5. Set the transaction fee 6. Display account information 7. Exit Please enter your choice: 1 Deposit amount. Enter value: -50 Enter value: (0 or greater): 50 Welcome to your bank Welcome to your bank 1. Make a deposit 2. Make a withdrawal 3. Set the account name 4. Set the account number 5. Set the transaction fee 6. Display account information 7. Exit Please enter your choice: 3 Enter the name: Joe Smith Welcome to your bank 1. Make a deposit 2. Make a withdrawal 3. Set the account name 4. Set the account number. 5. Set the transaction fee 6. Display account information 7. Exit Please enter your choice: 4 Account number. Enter value: 23456 Welcome to your bank 1. Make a deposit 2. Make a withdrawal 3. Set the account name 4. Set the account number 5. Set the transaction fee 6. Display account information 7. Exit Please enter your choice: 6 Account Information Number: Name: Balance: Transaction Fee: 23456 Joe Smith 49.00 1.00
Expert Answer:
Answer rating: 100% (QA)
To Run javac BankAccountjava javac CheckingAccountjava javac Bankjava java Bank Code BankAccountjava public class BankAccount protected int acctNum protected String name protected double balance Const... View the full answer
Related Book For
Posted Date:
Students also viewed these chemical engineering questions
-
RUN THE CODE import java.security.MessageDigest; public class MD5Digest { public static void main(String[] args) throws Exception { //Copy and paste this section of code String original = "letmein";...
-
The following two codes are executed for which a wrong input of 4.3 is entered. How the execution of these codes will be different and why? [2 points] import java.util.Scanner; import...
-
The industry demand curve for a particular market is: Q = 1800 - 200P. The industry exhibits constant long-run average cost at all levels of output, regardless of the market structure. Long-run...
-
Neer Department Store uses the retail inventory method to estimate its monthly ending inventories. The following information is available for two of its departments at August 31, 2011. Sporting Goods...
-
Why is it easier for programmers to perpetrate a fraud than operators?
-
Explain the terms which are implied into contracts for the sale of goods by ss 13, 14(2), 14(3), and 15 of the Sale of Goods Act 1979.
-
Use Laplace transforms to convert the following nonhomogeneous systems of differential equations into an algebraic system, and find the solutions of the differential equations. a. \[\begin{aligned}...
-
Disclosures Required in Various Situations Ace Inc. produces electronic components for sale to manufacturers of radios, television sets, and digital sound systems. In connection with her examination...
-
Y8 . Problem 3-20 (Algo) An analyst must decide between two different forecasting techniques for weekly sales of roller blades: a linear trend equation and the naive approach. The linear trend...
-
A fraction nonconforming control chart with n = 400 has the following parameters: UCL = 0.0962; Center line = 0.0500; LCL = 0.0038. (a) Find the width of the control limits in standard deviation...
-
Given the four points in the plane A = (-3,6), B = (0, -2), C = (3,3), and D= (5,-6), the graph of the function f(x) con- sists of the three line segments AB, BC, and CD. Evaluate the integral below....
-
Describe four recommendations made by the National Commission on Fraudulent Financial Reporting.
-
An auditor ordinarily uses a working trial balance resembling the financial statements without foot-a. Cash flow increases and decreases. b. Audit objectives and assertions. c. Reclassifications and...
-
Explain friction circle.
-
How does the auditor use the audit risk model to help plan the audit?
-
What is meant by integrity?
-
What differences are there between liquids and gases? Only liquids have definite volume O Only liquid particles can move from their relative position Only gases can be compressed Only liquids have...
-
What is beacon marketing? What are digital wallets?
-
Modify the FXPhotoFrame.java application to include a CSS file to make the interface design more attractive to potential customers. Save the project as CSSFXPhotoFrame.
-
a. Write an application that instantiates a JFrame that contains a JButton. Disable the JButton after the user clicks it. Save the file as JFrameDisableButton.java. b. Modify the JFrameDisableButton...
-
Write a program that declares two LocalDate objects and assign values that represent January 31 and December 31 in the current year. Display output that demonstrates the dates displayed when one,...
-
\(3 \pi+7 \sqrt{21}=7 \sqrt{21}+3 \pi\) Identify the property of real numbers that is being illustrated.
-
\((-10 \pi)+10 \pi=0\) Identify the property of real numbers that is being illustrated.
-
\(14 \times(3 \sqrt{2}+11.6)=14 \times 3 \sqrt{2}+14 \times 11.6\) Identify the property of real numbers that is being illustrated.
Study smarter with the SolutionInn App