Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

TCSS 143 A Programming Assignment 2 Due: May 13th 2023, 11:59 PM on Canvas NOTE: Be sure to adhere to the University's Policy on

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

TCSS 143 A Programming Assignment 2 Due: May 13th 2023, 11:59 PM on Canvas NOTE: Be sure to adhere to the University's Policy on Academic Integrity. Programming assignments are to be written individually and submitted programs must be the result of your own efforts. Any suspicion of academic integrity violation will be dealt with accordingly. Purpose: This programming assignment will evaluate your understanding of concepts of inheritance, abstraction, and lists. Goals: Successful completion of the assignment means that the student can implement a program with interfaces, abstract classes, and classes. This assignment is aimed towards the following learning outcomes: Understand the requirements from different sources: end-user and developer Model real-world scenarios using simple inheritance and class designs . Code simple methods (with 1-10 lines of code) Handle edge cases and exceptions Evaluation Scheme: The assignment is for 100 points and the rubric for evaluation is Criteria Points Correct files and file names submitted 1 Code compiles successfully 10 Documentation: Code has comments - Javadoc, single line, and multi-line comments 5 Programming notations and rules followed 2 Correct Implementation 60 Program generates expected output 10 UML 5 Client program (Main method) to demonstrate the prototype 7 Submission guidelines: You need to submit a zip file named _PA2.zip. The zip will consist of Source code - 7 java files + 1 java file for Bonus Document - Javadoc files and UML diagram. Please mention your IDE and Java version in the class level Javadoc comments 1 Problem Description: TownX Inc. reviewed your prototype of e-LMS and has decided to hire you to develop the banking software for one of its new financial establishments. You need to deliver a working prototype based on the preliminary requirements - Provision of banking accounts. Each banking account is identified by account id, the amount in the account and the type of account. A bank customer can open any of the two types of accounts - Checking account and Savings account. An account can be opened with minimum amount only. The bank plans to open other types of savings accounts too, and now provides only Regular Savings account. Each savings account type also maintains the savings rate for the given account type. A bank customer can hold multiple accounts. Each bank account provides withdrawal and deposit operations on the account. These operations depend on the type of account. Every customer can additionally perform the following operations - open an account, close an account, make a transaction on the account, get report of the accounts that customer holds, all the transactions made, and all the transactions made given the account. Every transaction holds the information - account id, amount, whether the transaction is credit or debit. Your team lead has provided you the technical specifications (a part of the SRS - software requirements specification) with design of required classes. You are required to meet the specific outputs for given Test Cases. Create a package tcss143. Banking. This should include the classes in Step 1 and 2. It is upto you to decide if you want to create further packages for step 1 and step 2, but you would have to handle the encapsulated fields. Step 1: Model Bank Account 1. Model the abstract concept of bank account. a. Implement an abstract class BankAccount with account id of type String, type of account of data type String and the amount that the account currently holds (prefer double datatype). Make sure these fields are encapsulated such that they can be inherited but remain private to the super and subclasses. b. The type of account for now are defined as - "checking" and "saving. (You are free to use String or Enum type) c. Implement constructor that accepts all the above three fields. d. Implement the getters and setters so that client can access encapsulated fields. 1 These specifications have been simplified and are imaginary. None of these reflect the real world scenario or implementations. 2 e. Override toString() method from the Object superclass. The format of output should be - Eg: "checking $5.00. f. The abstract methods are: withdraw () and deposit () that accept the amount of type double and return nothing. 2. Model the abstract concept of Savings account (Note: We have this as abstract class because, as per end-user requirements, there are plans to provision various types of savings account. So, a customer cannot directly own a savings account, but its specific type. Even though we have only one type of savings account, as a software designer you need to provide provisions for extendibility of requirements and code to make it easy for maintenance) a. Implement an abstract class Savings Account that inherits the concept of bank account and maintains savings rate of type double which is encapsulated and can be inherited. b. Implement constructor for the inherited class which passes a constant value for the type of account - "saving". c. Implement getter for the field(s). d. Implement the withdraw() method. The logic is to deduct given amount from the amount in the bank (bank amount = bank amount - amount). Make sure to handle the cases with "Insufficient Balance". Use exceptions. 3. Create class named CheckingAccount that inherits the abstract concept of banking account. a. Implement constructor for the inherited class which passes a constant value for the type of account - "checking". b. Implement the inherited abstract methods. Use the logic in 2.d. For deposit(), the logic is to add given amount to the amount in the bank (bank amount = bank amount + amount) 4. Create class named RegularSavings Account that inherits Savings Account. a. Implement constructor for the inherited class and sets the savings rate to 0.01. b. Implement the abstract method for deposit, the logic for which is : bank amount bank amount + amount + amount * savings rate. Note: a. Handle exceptions whenever required or necessary. You can create custom messages for exceptions (throw new Exception ("This is example");). Use your judgement to decide on what type of exceptions are required (Eg: Runtime exception, etc) b. Use @Override annotation above each method that you override in subclasses. Though there are no points allotted for this. c. Hint: Observe the above classes and see where you can use super([params]) for the constructors without need for any additional statements. d. You can use enum if you want to do so. 3 Step 2: Model Bank Customer 1. The state and behavior of the bank customer entity is modelled using 2 classes and 1 interface. 2. Create a class Transaction to model the transactions that happens (Note: It is common to have such classes and even with only one logic or purpose - Refer to term POJOS (Plain Old Java objects)) a. There are three encapsulated fields - account ID, amount of the transaction and the type of transaction (it is credit or debit) b. Implement a constructor that will accept all th encapsulated fields. c. Implement getters and setters for all the fields. d. Override the toString() method (You are free to choose the format, but it should represent all the fields) 3. Create a class BankCustomer should hold three encapsulated fields i. Name of the customer ii. List of all bank accounts (Make use of polymorphism so that a the list can hold multiple type of accounts for a customer) iii. List of all transactions made iv. Implement all the methods in the interface below. Hint: Use List of objects. 4. Create an interface named AccountActions that abstracts the following methods a. openAccount ([accountID, amount, typeOfAccount]): creates the given type of account with given ID and amount for the customer. b. closeAccount([accountID]): closes the give account for the customer c. makeTransaction([accountID,amount, typeOfTransaction]): typeOfTransaction is credit or debit, creates a transaction type for each account and stores them. d. printTransaction Report ([accountID]): prints all the transactions made by the customer under the given accountID. e. printTransactionReport() : prints all the transactions that customer has made (note this is for all the accounts) f. printAllAccounts(): prints the list of all accounts the customer holds (Hint: use toString()) Step 3: Documentation Generate UML diagram: You can draw the diagram using UML software freely available (eg. draw.io), you can use PowerPoint too. If you know how to generate your UML diagrams in IDE, it is recommended to do so. Please see (https://developer.ibm.com/articles/the-class-diagram/) Create html for Javadoc for the package. 4 Step 4: Implement your own client program in another package tcss143.bankclient. Create two customers - Alice and Bob. (2 points) Demonstrate opening and closing of accounts and print methods for these customers. Create another customer - Charlie (5 points) Create a prompt-based menu for the customer. The options should be "Select: 1. Make Transaction 2. Print Transactions for Account 3. Print all transactions 4. Print all accounts 5. Exit" Use the above menu to check all the operations defined in the interface and demonstrate the various edge cases and exceptional cases.

Step by Step Solution

3.51 Rating (148 Votes )

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_2

Step: 3

blur-text-image_3

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

Auditing and Assurance services an integrated approach

Authors: Alvin a. arens, Randal j. elder, Mark s. Beasley

14th Edition

133081605, 132575957, 9780133081602, 978-0132575959

More Books

Students also viewed these Programming questions

Question

Define what is meant by a tick mark. What is its purpose?

Answered: 1 week ago