In this phase you’ll be writing code within the methods of your classes to make the tests pass. Account Each account should have a constant, unique id. Id numbers should start from 1000 and increment by 5. The ACCOUNT_ID attribute should be initialised when the account object is created. The id should be generated internally within the class, it should not be passed in as an argument. The deposit method should increase the balance by the value passed in as an argument. The withdraw method should reduce the balance by the value passed in as an argument. It should return the value of the argument The account should be able to go overdrawn The correctBalance method should change the balance to match the value passed in as an argument. Testing your code for Account Run TestAccountInitialisation to check that the ID has been set correctly. Run TestAccountMethods to check that all of the methods work. Customer Each customer should have a constant, unique id. Id numbers should start from 2000000 and increment by 7. The CUSTOMER_ID attribute should be initialised when the account object is created. The id should be generated internally within the class, it should not be passed in as an argument. The customer’s name and address should be set when the customer object is created. The addAccount() method should take an account object as an argument and add it to the list of accounts stored within the customer. The removeAccount() method should take an account object as an argument and remove it from the list of accounts stored within the customer. Testing your code for Customer Run TestCustomerInitialisation to check that id has been set correctly. Run TestCustomerMethods to check that the addAccount() and removeAccount() methods work and that the name and address have been set correctly. SavingsAccount It should not be possible for the savings account to go overdrawn. In the case that an amount larger than the balance is passed into the withdraw method, nothing should be subtracted from the balance and zero should be returned. The addInterest() method should calculate the interest due on the account and add it to the balance. The formula to calculate the interest due is balance * interest rate / 100. Testing your code for SavingsAccount Run TestSavingsAccount. CheckingAccount The getNextCheckNumber() method should return the value of the nextCheckNumber variable. The first check should have number 1. Each subsequent check number should count up by one. Testing your code for CheckingAccount Run TestCheckingAccount Person The chargeAllAccounts method should be implemented so that the amount passed in is subtracted from from the balance of each of the person’s accounts. Testing your code for Person Run TestPerson Company The chargeAllAccounts method should be implemented so that the amount passed in is subtracted from the balance of all of the company’s checking accounts. The amount subtracted from the balance of all of the company’s savings accounts should be doublethe amount passed in. Testing your code for Company Run TestCompany AccountController The createCustomer method takes a name, address and customer type as arguments. If the type is “person”, createCustomer should create a Person object with the correct name and address. It should add the Person object to the account controller’s list of Person objects. It should return the Person object. If the type is “company”, createCustomer should create a Company object with the correct name and address. It should add the Company object to the account controller’s list of Company objects. It should return the Company object. The createAccount method takes a Customer object and an account type as arguments. If the type is “checking”, createAccount should create a CheckingAccount object, add the object to accountController’s list of accounts and to the customer’s list of accounts. It should return the CheckingAccount object. If the type is “savings”, createAccount should create a SavingsAccount object, add the object to accountController’s list of accounts and to the customer’s list of accounts. It should return the SavingsAccount object. The removeAccount method takes an Account object as an argument. It should remove the account from the account controller’s list of accounts. It should remove the account from the customer’s list of accounts. The removeCustomer method takes a Customer object as an argument. It should remove the customer from the account controller’s list of customers. It should remove all of the customer’s accounts from the account controller’s list of accounts
In this phase you’ll be writing code within the methods of your classes to make the tests pass. Account Each account should have a constant, unique id. Id numbers should start from 1000 and increment by 5. The ACCOUNT_ID attribute should be initialised when the account object is created. The id should be generated internally within the class, it should not be passed in as an argument. The deposit method should increase the balance by the value passed in as an argument. The withdraw method should reduce the balance by the value passed in as an argument. It should return the value of the argument The account should be able to go overdrawn The correctBalance method should change the balance to match the value passed in as an argument. Testing your code for Account Run TestAccountInitialisation to check that the ID has been set correctly. Run TestAccountMethods to check that all of the methods work. Customer Each customer should have a constant, unique id. Id numbers should start from 2000000 and increment by 7. The CUSTOMER_ID attribute should be initialised when the account object is created. The id should be generated internally within the class, it should not be passed in as an argument. The customer’s name and address should be set when the customer object is created. The addAccount() method should take an account object as an argument and add it to the list of accounts stored within the customer. The removeAccount() method should take an account object as an argument and remove it from the list of accounts stored within the customer. Testing your code for Customer Run TestCustomerInitialisation to check that id has been set correctly. Run TestCustomerMethods to check that the addAccount() and removeAccount() methods work and that the name and address have been set correctly. SavingsAccount It should not be possible for the savings account to go overdrawn. In the case that an amount larger than the balance is passed into the withdraw method, nothing should be subtracted from the balance and zero should be returned. The addInterest() method should calculate the interest due on the account and add it to the balance. The formula to calculate the interest due is balance * interest rate / 100. Testing your code for SavingsAccount Run TestSavingsAccount. CheckingAccount The getNextCheckNumber() method should return the value of the nextCheckNumber variable. The first check should have number 1. Each subsequent check number should count up by one. Testing your code for CheckingAccount Run TestCheckingAccount Person The chargeAllAccounts method should be implemented so that the amount passed in is subtracted from from the balance of each of the person’s accounts. Testing your code for Person Run TestPerson Company The chargeAllAccounts method should be implemented so that the amount passed in is subtracted from the balance of all of the company’s checking accounts. The amount subtracted from the balance of all of the company’s savings accounts should be doublethe amount passed in. Testing your code for Company Run TestCompany AccountController The createCustomer method takes a name, address and customer type as arguments. If the type is “person”, createCustomer should create a Person object with the correct name and address. It should add the Person object to the account controller’s list of Person objects. It should return the Person object. If the type is “company”, createCustomer should create a Company object with the correct name and address. It should add the Company object to the account controller’s list of Company objects. It should return the Company object. The createAccount method takes a Customer object and an account type as arguments. If the type is “checking”, createAccount should create a CheckingAccount object, add the object to accountController’s list of accounts and to the customer’s list of accounts. It should return the CheckingAccount object. If the type is “savings”, createAccount should create a SavingsAccount object, add the object to accountController’s list of accounts and to the customer’s list of accounts. It should return the SavingsAccount object. The removeAccount method takes an Account object as an argument. It should remove the account from the account controller’s list of accounts. It should remove the account from the customer’s list of accounts. The removeCustomer method takes a Customer object as an argument. It should remove the customer from the account controller’s list of customers. It should remove all of the customer’s accounts from the account controller’s list of accounts
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
JAVA QUESTION REQUIRES SEPARATE CLASSES, CANNOT BE WRITTEN IN ONE MAIN METHOD E.G. ACCOUNT SECTION WRITTEN IN ACCOUNT CLASS, CUSTOMER SECTION WRITTEN IN CUSTOMER CLASS ETC.
Phase 2
In this phase you’ll be writing code within the methods of your classes to make the tests pass.
Account
- Each account should have a constant, unique id. Id numbers should start from 1000 and increment by 5. The ACCOUNT_ID attribute should be initialised when the account object is created. The id should be generated internally within the class, it should not be passed in as an argument.
- The deposit method should increase the balance by the value passed in as an argument.
- The withdraw method should reduce the balance by the value passed in as an argument. It should return the value of the argument
- The account should be able to go overdrawn
- The correctBalance method should change the balance to match the value passed in as an argument.
Testing your code for Account
- Run TestAccountInitialisation to check that the ID has been set correctly.
- Run TestAccountMethods to check that all of the methods work.
Customer
- Each customer should have a constant, unique id. Id numbers should start from 2000000 and increment by 7. The CUSTOMER_ID attribute should be initialised when the account object is created. The id should be generated internally within the class, it should not be passed in as an argument.
- The customer’s name and address should be set when the customer object is created.
- The addAccount() method should take an account object as an argument and add it to the list of accounts stored within the customer.
- The removeAccount() method should take an account object as an argument and remove it from the list of accounts stored within the customer.
Testing your code for Customer
- Run TestCustomerInitialisation to check that id has been set correctly.
- Run TestCustomerMethods to check that the addAccount() and removeAccount() methods work and that the name and address have been set correctly.
SavingsAccount
- It should not be possible for the savings account to go overdrawn. In the case that an amount larger than the balance is passed into the withdraw method, nothing should be subtracted from the balance and zero should be returned.
- The addInterest() method should calculate the interest due on the account and add it to the balance. The formula to calculate the interest due is balance * interest rate / 100.
Testing your code for SavingsAccount
- Run TestSavingsAccount.
CheckingAccount
- The getNextCheckNumber() method should return the value of the nextCheckNumber variable. The first check should have number 1. Each subsequent check number should count up by one.
Testing your code for CheckingAccount
- Run TestCheckingAccount
Person
- The chargeAllAccounts method should be implemented so that the amount passed in is subtracted from from the balance of each of the person’s accounts.
Testing your code for Person
- Run TestPerson
Company
- The chargeAllAccounts method should be implemented so that the amount passed in is subtracted from the balance of all of the company’s checking accounts. The amount subtracted from the balance of all of the company’s savings accounts should be doublethe amount passed in.
Testing your code for Company
- Run TestCompany
AccountController
- The createCustomer method takes a name, address and customer type as arguments.
- If the type is “person”, createCustomer should create a Person object with the correct name and address. It should add the Person object to the account controller’s list of Person objects. It should return the Person object.
- If the type is “company”, createCustomer should create a Company object with the correct name and address. It should add the Company object to the account controller’s list of Company objects. It should return the Company object.
- The createAccount method takes a Customer object and an account type as arguments.
- If the type is “checking”, createAccount should create a CheckingAccount object, add the object to accountController’s list of accounts and to the customer’s list of accounts. It should return the CheckingAccount object.
- If the type is “savings”, createAccount should create a SavingsAccount object, add the object to accountController’s list of accounts and to the customer’s list of accounts. It should return the SavingsAccount object.
- The removeAccount method takes an Account object as an argument.
- It should remove the account from the account controller’s list of accounts.
- It should remove the account from the customer’s list of accounts.
- The removeCustomer method takes a Customer object as an argument.
- It should remove the customer from the account controller’s list of customers.
It should remove all of the customer’s accounts from the account controller’s list of accounts.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education