Question: Section D: Write a Java program that can read inputs of bank accounts and print out the account data. The account can be either a
Section D:
Write a Java program that can read inputs of bank accounts and print out the account data. The account can be either a checking account or a mortgage account.
First, the program reads an input of a numeric account code that identifies which type of account that the user wants to work with. The values of account code are:
1 for checking account
2 for mortgage account
The program should check to be sure that the user enters correct account code. Otherwise, the program asks the user to re-enter the code until it is correctly done.
Then, for the checking account, the user enters the following pieces of data from the console:
account number,
customer's full name,
checking balance (only 2 digits after decimal point)
For the mortgage account, the user enters the following pieces of data from the console:
account number,
customer's full name,
principal balance
interest rate
The program should check to be sure that checking balance, principal balance, and interest rate, are not negative.
The Java program is another Java class named AccountDisplayer in the same package, i.e. BANKACCOUNTS. To provide a solution to the problem, it is expected that inheritance and polymorphism are used in the coding.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
