Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

TestAccounts.java : import java.util.Date; public class TestAccounts { public static void main ( String [ ] args ) { Account obj = new Account (

TestAccounts.java :
import java.util.Date;
public class TestAccounts {
public static void main(String[] args){
Account obj = new Account (1122,20000);
obj.withdraw(2500);
obj.deposit(3000);
System.out.println("Balance : "+ obj-getBalance()+"S.R");
System.out.println("Account was created on : "+ obj.getDateCreated());
}
}
class Account {
private int id;
private double balance;
private Date dateCreated;
public Account(){
id =0;
balance =0.0;
dateCreated = null;
}
public Account(int id, double balance){
this.id = id;
this.balance = balance;
}
this.dateCreated = new );
public int getId(){
return id;
}
public double getBalance(){
}
return balance;
public void setId(int id){
this.id = id;
}
Balance : 20500.0 S.R
Account was created on > : Sat Mar 0208:05:26 GMT 2024
.. Program finished with exit code 0
Press ENTER to exit console.
TestAccounts.java :
public Account(int id, double balance){
this.id = id;
this.balance = balance;
this. dateCreated = new Date();
}
public int
return id;
}
public double getBalance(){
return balance;
}
public void setId(int id){
this.id = id;
}
public void setBalance(double balance){
this.balance = balance;
}
public Date getDateCreated(){
return dateCreated;
}
public void withdraw(double amount){
}
this.balance -= amount;
public void deposit(double amount){
this.balance += amount;
}
}
class SavingAccount extends Account {
}
class Checking extends Account {
}
Balance : 20500.0 S.R
Account was created on > : Sat Mar 0208:05:26 GMT 2024
.. Program finished with exit code 0
Press ENTER to exit console.
( i want you to solve this in java ..
the Account class was defined to model a bank account. An account has the properties account number, balance, 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 objects of Account,
SavingsAccount, and CheckingAccount and invokes their
toString() methods)
image text in transcribed

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

Microsoft Office 365 For Beginners 2022 8 In 1

Authors: James Holler

1st Edition

B0B2WRC1RX, 979-8833565759

More Books

Students also viewed these Databases questions

Question

=+7. What impediments originate in society at large?

Answered: 1 week ago

Question

What is the orientation toward time?

Answered: 1 week ago

Question

4. How is culture a contested site?

Answered: 1 week ago