Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA accountTest.java file: public class accountTest { public static void main (String[] args) { Account account = new Account(1122, 20000); Account.setAnnualInterestRate(4.5); account.withdraw(2500); account.deposit(3000); System.out.println(Balance is

image text in transcribed

JAVA

accountTest.java file:

public class accountTest { public static void main (String[] args) { Account account = new Account(1122, 20000); Account.setAnnualInterestRate(4.5); account.withdraw(2500); account.deposit(3000); System.out.println("Balance is " + account.getBalance()); System.out.println("Monthly interest is " + account.getMonthlyInterest()); System.out.println("This account was created at " + account.getDateCreated()); } } class Account { private int id; private double balance; private static double annualInterestRate; private java.util.Date dateCreated; public Account() { dateCreated = new java.util.Date(); } public Account(int newId, double newBalance) { id = newId; balance = newBalance; dateCreated = new java.util.Date(); } public int getId() { return this.id; } public double getBalance() { return balance; } public static double getAnnualInterestRate() { return annualInterestRate; } public void setId(int newId) { id = newId; } public void setBalance(double newBalance) { balance = newBalance; } public static void setAnnualInterestRate(double newAnnualInterestRate) { annualInterestRate = newAnnualInterestRate; } public double getMonthlyInterest() { return balance * (annualInterestRate / 1200); } public java.util.Date getDateCreated() { return dateCreated; } public void withdraw(double amount) { balance -= amount; } public void deposit(double amount) { balance += amount; } } 
The Account class in account Test.,java was defined to model a bank account. An account has the prop- erties account number, balance, annual interest rate, and date created, and methods to deposit and withdraw funds. Create two subclasses for checking and saving accounts. A checking account has an "overdraft limit", but a savings account "cannot" be overdrawn. Draw the UML diagram for the classes and then implement them. Write a test program that creates ob- jects of Account, SavingsAccount, CheckingAccount, there compliance with the overdraft conditions, and invokes their toString0 methods. Convert your UML diagram to PDF and store it in the root directory of your project outside the src and bin folders prior to preparing yourtar archive for submission. ML diagram is worth 1 point The Account class in account Test.,java was defined to model a bank account. An account has the prop- erties account number, balance, annual interest rate, and date created, and methods to deposit and withdraw funds. Create two subclasses for checking and saving accounts. A checking account has an "overdraft limit", but a savings account "cannot" be overdrawn. Draw the UML diagram for the classes and then implement them. Write a test program that creates ob- jects of Account, SavingsAccount, CheckingAccount, there compliance with the overdraft conditions, and invokes their toString0 methods. Convert your UML diagram to PDF and store it in the root directory of your project outside the src and bin folders prior to preparing yourtar archive for submission. ML diagram is worth 1 point

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

More Books

Students also viewed these Databases questions

Question

U11 Informing Industry: Publicizing Contract Actions 317

Answered: 1 week ago

Question

4. What action should Cherita Howard take and why?

Answered: 1 week ago