Question: 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)
 TestAccounts.java : import java.util.Date; public class TestAccounts { public static void

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!