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...
-
Suppose that is a compact subset of R. If for every x E there exist a nonnegative function f = fx and an r = r(x) > 0 such that f is C on R, f(t) = 1 for t (x - r, x + r), and f(t) = 0 for t (x -...
-
A sample of 233/92U (T = 1.59 X 105yr) contains 7.50 X 1019 nuclei. (a) What is the decay constant? (b) Approximately how many disintegrations will occur per minute?
-
Describe surrogacy and the legal and ethical issues that can arise.
-
Whittington Company produces two types of leather purses: standard and handcrafted. Both purses use equipment for cutting and stitching. The equipment also has the capability of creating standard...
-
The concentration of two medicines Prinivil and Zestril in the bloodstream x hours after being injected are: Prinivil: f(x) = xe* and Zestril: h(x) = xe x>0 When (if at all) does Prinivil disperse...
-
Of all the price analysis methodologies that exist, which are the foundational methods. Longing & Shorting. Trading & Investing. Volume & sentiment. On-chain & Macroeconomic. Mean reversion &...
-
50. Research by Jeremy Stein of MIT resolves the dispute over whether beta is a sufficient pricing factor by suggesting that managers should use beta to estimate A. long-term returns but not...
-
The rise of Ant has been watched closely by many in the banking industry, not lest the CEO and Chairman of JP Morgan Chase, Mr Jamie Dimon. They have kept a wary and admiring eye on the rise of Ant...
-
1. Consider the following model.The banking industry holds one kind of deposit, a checking deposit. The money supply is defined to be currency in the hands of the public (C) plus deposits (D). The...
-
Dr. Lange saw an established patient in the office for recent syncopal attacks. Comprehensive history and examination were performed. Medical decision making is of high complexity. Identify the CPT...
-
3) How did online banking technology change the cost structure of banks in terms of variable and fixed costs? How did this affect the structure of the banking industry? 4) Suppose that a market is...
-
Types of communication: a. What types of communication (synchronous or asynchronous) does your team use most often? b. Why do you choose to use that type of communication? c. What factors influence...
-
Economic Analysis for Managers B. Connect outcomes from Courseto Workplace -Describe specific (to your workplace/job) examples of connections you are making between the learning in your course and...
-
Privitera and Freeman (2012) constructed a scale to measure or estimate the daily fat intake of participants; the scale was called the estimated daily intake scale for fat (EDIS-F). To validate the...
-
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,...
-
What is the activity in \(\mathrm{Bq}\) and in \(\mathrm{Ci}\) of a \(2.0 \mathrm{mg}\) sample of \({ }^{3} \mathrm{H}\) ?
-
The activity of a sample of the cesium isotope \({ }^{137} \mathrm{Cs}\) is \(2.0 \times 10^{8} \mathrm{~Bq}\). Many years later, after the sample has fully decayed, how many beta particles will have...
-
The technique known as potassiumargon dating is used to date volcanic rock and ash, and thus establish dates for nearby fossils, like this 1.8 -millionyear-old hominid skull. The potassium isotope...
Study smarter with the SolutionInn App