Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem First American Bank provides both normal bank services like checking accounts and mortgages to its customers. Each customer who uses checking services has a

Problem First American Bank provides both normal bank services like checking accounts and mortgages to its customers. Each customer who uses checking services has a checking account. Each customer who gets a mortgage loan from the bank has a mortgage account. The bank executives ask a team of software analysts to develop a system to manage its customers' bank accounts. Section A: Define an abstract Java class named BankAccount in a package named BANKACCOUNTS. This class has three attributes: (1) Acount number: an integer of 10 digits, defined as protected (2) Account type: String (e.g.: "CHECKING" versus "MORTGAGE"), defined as protected (3) Customer's full name: String, defined as protected Class BankAccount definition provides a default constructor get-methods and set-methods for the variable attributes, a public method, named "displayAccountData()", that prints out the following pieces of data: account number, account type, and customer's full name in only one line. Section B: Define a Java class named CheckingAccount in the same package, BANKACCOUNTS, that extends the class BankAccount. Class CheckingAccount has only one attribute: checking balance, that is defined as private. Class CheckingAccount definition provides: a default constructor, another constructor that accepts account number and customer's full name as two different parameters get-method and set-method for the attribute checking balance, a public method (displayAccountData()) that overrides the method of the same name of the superclass BankAccount and prints out the following pieces of data in only one line: o account number, o account type, o customer's full name, o checking balance (only 2 digits after decimal point) Section C: Define a Java class named MortgageAccount in the same package, BANKACCOUNTS, that extends the above class BankAccount. Class MortgageAccount has two attributes: principal balance that is defined as private. interest rate that is defined as private. Class MortgageAccount definition provides: a default constructor, another constructor that accepts account number and customer's full name as two different parameters get-method and set-method for eachvariable attribute a public method (displayAccountData()) that overrides the method of the same name of the superclass BankAccount and prints out the following pieces of data in only one line: o account number, o account type, o customer's full name, o the principal balance (only 2 digits after decimal point), o the interest rate (only 2 digits after decimal point) 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

Step: 1

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

AutoCAD Database Connectivity

Authors: Scott McFarlane

1st Edition

0766816400, 978-0766816404

More Books

Students also viewed these Databases questions