Assignment #4: Arrays and ArrayLists
Due: Monday, March 16th @ 11:55PM
Total Possible Points: 20
How to Submit
Moodle assignment (no emails or hardcopies accepted)
Submit IDE project in zip or RAR format as Assignment4.zip or Assignment4.rar
Goals
To understand how to use arrays to store and retrieve data.
To understand how to use the ArrayList data structure to store and retrieve data.
To design and develop classes that model real-world entities
Your Task
In this assignment, you will write create three classes that serve as the start of a small banking system. Your program will use an array list to store transactions in a bank account, and an array to store bank accounts in a bank. You will also make use of iterative algorithms to help you complete various tasks – namely entering bank account information, finding a particular bank account, and computing the average size of a transaction.
(*) Feel free to reuse the code of the Bank and BankAccount classes in the ch07.bank package of the BIG JAVA sample code. Make sure you delete methods that you are not using!
Requirements/Grading
Create a new NetBeans project named CS218 Assignment 4. Be sure to uncheck “Create Main Class” during the project setup. Create a new package named bank. All three (3) classes described below belong in the bank package.
1. Implement a BankAccount class (6 points total)
Three (3) private instance variables: int accountNumber double balance
ArrayList<Double> transactions
One (1) constructor: (2 points)
BankAccount(int acctNumber, double initBalance) – initializes the class’ instance variables, using the parameter variable values appropriately
Assigns a new ArrayList object to transactions. Don’t forget to add an import statement above your class to link the java.util.ArrayList library to your code.
Adds a transaction to transactions…think of initBalance as the amount of the initial deposit.
Five (5) public methods: int getAccountNumber() – returns the account number double getBalance() – returns the balance void deposit(double amount) – adds money to the account; adds a new transaction to the array list of transactions (1 point) void withdraw(double amount) – subtracts money from the account; adds a new transaction to the list of transactions (withdrawal amount should be added as a negative number) (1 point) double getAverageTransactionSize() – returns the average of the absolute values of all transaction amounts on the account. (2 points)
Uses a for-each loop in the calculation
Uses the Math.abs(double num) function to get the absolute value of each transaction amount.
2. Implement a Bank class (6 points total)
Three (3) private instance variables:
BankAccount[] accounts final int SIZE – the size of the accounts array; assign a value of 1000 int numAccounts – the number of accounts in the accounts array
One (1) constructor: (0.5 point)
Bank() – no parameters, but initializes accounts with a new BankAccount array of size SIZE.
Four (4) public methods: void addAccount(int aNumber, double aBalance) (2 points)
Creates a new BankAccount with the account number aNumber and the balance aBalance.
Puts the new BankAccount into the accounts array after the last existing account
Updates the number of accounts.
BankAccount find(int aNumber) – finds and returns the BankAccount in the accounts array whose account number matches aNumber. If so such bank account
HLT 310V WEEK 1 ASSIGNMENT PERSONAL WORLDVIEW INVENTORY To purchase this tutorial visit here: http://wiseamerican.us/product/hlt-310v-week-1-assignment-personal-worldview-inventory/ contact us at: SUPPORT@WISEAMERICAN.US Max Points: 20 Details: Write an 800-1,000-word essay on your personal worldview. Briefly discuss the various possible meanings of the term “spirituality,” and your understanding of the concepts of pluralism, scientism, and postmodernism. Primarily, address the following seven…
– Group Assignment Cover Page Instructor Name: Teresa Kucheran Assignment Name: Statement of Work Group Number: 10 Date of Submission: January 20th, 2015 The following students were present for the group discussion and contributed to the assignment as indicated: Student Name Contribution to Assignment 1.Veronica Osmikhovska Described in detail the Objectives for the SOW. 2.Allisha Samuels Refined and elaborated the Scope statement for the SOW. 3.Diptima Lamba Described in detail the constraints…
Introduction to Advanced Graduate Studies and Scholarship Details This course introduces students to the principal elements of research and scholarly writing. Learners explore approaches to synthesizing literature and the application of the major components of APA form and style, and learn to coordinate literature searches. Furthermore, they learn how to discern principal arguments, analyze research questions, and clearly identify the key scholarly attributes to journal articles and other sources…
hand and answered for himself (verse 1) 2. was humble yet confident as he proclaimed, “I think myself happy, King Agrippa …” (verse 2) 3. affirmed the king’s position by complimenting his expertise (verse 3) 4. admitted his life was an open book for he was known in Jerusalem (verse 4) 5. reminded them of his strict past in light of his new-found understanding of Christ (verses 5-8) 6. identified with his accusers (verses 9-11) 7. used a narrative to defend his change of heart (verses 12-18)…
ACIT2730 Assignment 2 Bug Tracking System Damian Kim A00909032 Set 2B 1. Use Case Diagram Note: I thought about Microsoft bug report that I never get respond back, so I assumed users do not need to be notified. 2. Use Case Scenarios Use Case Name Creates a bug report; when a user detects a bug, he/she can report the bug by creating a bug report. Primary Actor User Stakeholders and Interests: User creates a bug report with enough details in it User - wants the bug to be fixed…
KXT101 Programming & Problem Solving Semester 2, 2013 Release Date: 07 August, 2013 (Wednesday) Aims of the assignment The purpose of this assignment is to give students experience in writing a Java program which uses the following drills: • • • • • • Choice of suitable algorithm to match the problem requirements and their personal preferences Declare and use of variables of primitive types Use of common data types (primitive as well as reference types): int, String, char Use of branching control…
Group Research Assignment 1 Use your group members Homework Assignments 1 and the revised documents prepared in class. Choose only one company/product that the group wants to work on for the Group Research Project. USE THE FOLLOWING HEADINGS Company and Background Information Provide the name of the company chosen. Describe its location for a head office, brief details of the operation, their products or services, and target customers. Management Decision Problem Your company wants to increase…