SlideShare a Scribd company logo
1 of 5
Download to read offline
public class InsufficientFundsException extends Exception{
InsufficientFundsException(double balance)
{
System.out.println("insufficient funds .... available balance : "+balance);
}
}
// Account.java
public class Account throws InsufficientFundsException{
private int acctNo;
private String owner;
private double balance;
public Account(){
acctNo = 00;
owner = " ";
balance= 0.0;
}
public Account(int ac, String own, double bal){
acctNo = ac;
owner = own;
balance = bal;
}
public void Deposit(double amount){
balance = balance + amount;
}
public void Withdraw (double amount){
try {
if(amount>balance)
{
throw new InsufficientFundsException(balance);
}
else
balance =balance - amount;
}
catch(InsufficientFundsException e)
{
System. out.println(e.printStackTrace());
}
}
public int getAcctNo() {
return acctNo;
}
public void setAcctNo(int ac) {
acctNo = ac;
}
public String getOwner() {
return owner;
}
public void setOwner(String own) {
owner = own;
}
public double getBalance() {
return balance;
}
public void setBalance(double bal) {
balance = bal;
}
public void display(){
System.out.println("Account Number = " + getAcctNo());
System.out.println("Account Owner = " + getOwner());
System.out.println("Account Balance = $" + getBalance());
System.out.println();
}
}
public class TestExceptions{
public static void main(String args []){
Account a1;
a1 = new Account(2222, "Jimmy Zulu", 1000);
a1.Deposit(100);
a1.display();
Account a2;
a2 = new Account();
a2.setAcctNo(3333);
a2.setOwner("John Mwemba");
a2.setBalance(500);
a2.Deposit(100);
a2.Withdraw(900);
a2.display();
}
}
Solution
public class InsufficientFundsException extends Exception{
InsufficientFundsException(double balance)
{
System.out.println("insufficient funds .... available balance : "+balance);
}
}
// Account.java
public class Account throws InsufficientFundsException{
private int acctNo;
private String owner;
private double balance;
public Account(){
acctNo = 00;
owner = " ";
balance= 0.0;
}
public Account(int ac, String own, double bal){
acctNo = ac;
owner = own;
balance = bal;
}
public void Deposit(double amount){
balance = balance + amount;
}
public void Withdraw (double amount){
try {
if(amount>balance)
{
throw new InsufficientFundsException(balance);
}
else
balance =balance - amount;
}
catch(InsufficientFundsException e)
{
System. out.println(e.printStackTrace());
}
}
public int getAcctNo() {
return acctNo;
}
public void setAcctNo(int ac) {
acctNo = ac;
}
public String getOwner() {
return owner;
}
public void setOwner(String own) {
owner = own;
}
public double getBalance() {
return balance;
}
public void setBalance(double bal) {
balance = bal;
}
public void display(){
System.out.println("Account Number = " + getAcctNo());
System.out.println("Account Owner = " + getOwner());
System.out.println("Account Balance = $" + getBalance());
System.out.println();
}
}
public class TestExceptions{
public static void main(String args []){
Account a1;
a1 = new Account(2222, "Jimmy Zulu", 1000);
a1.Deposit(100);
a1.display();
Account a2;
a2 = new Account();
a2.setAcctNo(3333);
a2.setOwner("John Mwemba");
a2.setBalance(500);
a2.Deposit(100);
a2.Withdraw(900);
a2.display();
}
}

More Related Content

Similar to public class InsufficientFundsException extends Exception{Insuffic.pdf

I need help creating a basic and simple Java program. Here is the ex.pdf
I need help creating a basic and simple Java program. Here is the ex.pdfI need help creating a basic and simple Java program. Here is the ex.pdf
I need help creating a basic and simple Java program. Here is the ex.pdf
rajeshjangid1865
 
Java programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdfJava programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdf
fathimafancy
 
Account.h Definition of Account class. #ifndef ACCOUNT_H #d.pdf
Account.h  Definition of Account class. #ifndef ACCOUNT_H #d.pdfAccount.h  Definition of Account class. #ifndef ACCOUNT_H #d.pdf
Account.h Definition of Account class. #ifndef ACCOUNT_H #d.pdf
anujmkt
 
Flow-Centric, Back-In-Time Debugging
Flow-Centric, Back-In-Time DebuggingFlow-Centric, Back-In-Time Debugging
Flow-Centric, Back-In-Time Debugging
lienhard
 
Can you fix the problem with the following code #include -iostream- #.pdf
Can you fix the problem with the following code  #include -iostream- #.pdfCan you fix the problem with the following code  #include -iostream- #.pdf
Can you fix the problem with the following code #include -iostream- #.pdf
vinaythemodel
 
import java.util.LinkedList;import java.util.Scanner;public cla.pdf
import java.util.LinkedList;import java.util.Scanner;public cla.pdfimport java.util.LinkedList;import java.util.Scanner;public cla.pdf
import java.util.LinkedList;import java.util.Scanner;public cla.pdf
fakhrifoam
 
import java.util.Scanner;import java.text.DecimalFormat;import j.pdf
import java.util.Scanner;import java.text.DecimalFormat;import j.pdfimport java.util.Scanner;import java.text.DecimalFormat;import j.pdf
import java.util.Scanner;import java.text.DecimalFormat;import j.pdf
KUNALHARCHANDANI1
 

Similar to public class InsufficientFundsException extends Exception{Insuffic.pdf (20)

I need help creating a basic and simple Java program. Here is the ex.pdf
I need help creating a basic and simple Java program. Here is the ex.pdfI need help creating a basic and simple Java program. Here is the ex.pdf
I need help creating a basic and simple Java program. Here is the ex.pdf
 
Class 6 2ciclo
Class 6 2cicloClass 6 2ciclo
Class 6 2ciclo
 
Java programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdfJava programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdf
 
4. Обработка ошибок, исключения, отладка
4. Обработка ошибок, исключения, отладка4. Обработка ошибок, исключения, отладка
4. Обработка ошибок, исключения, отладка
 
Account.h Definition of Account class. #ifndef ACCOUNT_H #d.pdf
Account.h  Definition of Account class. #ifndef ACCOUNT_H #d.pdfAccount.h  Definition of Account class. #ifndef ACCOUNT_H #d.pdf
Account.h Definition of Account class. #ifndef ACCOUNT_H #d.pdf
 
Flow-Centric, Back-In-Time Debugging
Flow-Centric, Back-In-Time DebuggingFlow-Centric, Back-In-Time Debugging
Flow-Centric, Back-In-Time Debugging
 
Jva
Jva Jva
Jva
 
Clojure workshop
Clojure workshopClojure workshop
Clojure workshop
 
Practical approach for testing your software with php unit
Practical approach for testing your software with php unitPractical approach for testing your software with php unit
Practical approach for testing your software with php unit
 
“SOLID principles in PHP – how to apply them in PHP and why should we care“ b...
“SOLID principles in PHP – how to apply them in PHP and why should we care“ b...“SOLID principles in PHP – how to apply them in PHP and why should we care“ b...
“SOLID principles in PHP – how to apply them in PHP and why should we care“ b...
 
Can you fix the problem with the following code #include -iostream- #.pdf
Can you fix the problem with the following code  #include -iostream- #.pdfCan you fix the problem with the following code  #include -iostream- #.pdf
Can you fix the problem with the following code #include -iostream- #.pdf
 
Inheritance
InheritanceInheritance
Inheritance
 
Les exceptions, oui, mais pas n'importe comment
Les exceptions, oui, mais pas n'importe commentLes exceptions, oui, mais pas n'importe comment
Les exceptions, oui, mais pas n'importe comment
 
Bank account in java
Bank account in javaBank account in java
Bank account in java
 
5 Rmi Print
5  Rmi Print5  Rmi Print
5 Rmi Print
 
import java.util.LinkedList;import java.util.Scanner;public cla.pdf
import java.util.LinkedList;import java.util.Scanner;public cla.pdfimport java.util.LinkedList;import java.util.Scanner;public cla.pdf
import java.util.LinkedList;import java.util.Scanner;public cla.pdf
 
import java.util.Scanner;import java.text.DecimalFormat;import j.pdf
import java.util.Scanner;import java.text.DecimalFormat;import j.pdfimport java.util.Scanner;import java.text.DecimalFormat;import j.pdf
import java.util.Scanner;import java.text.DecimalFormat;import j.pdf
 
Ejb examples
Ejb examplesEjb examples
Ejb examples
 
The account problem in Java and Clojure
The account problem in Java and ClojureThe account problem in Java and Clojure
The account problem in Java and Clojure
 
Creating a Facebook Clone - Part XLVI - Transcript.pdf
Creating a Facebook Clone - Part XLVI - Transcript.pdfCreating a Facebook Clone - Part XLVI - Transcript.pdf
Creating a Facebook Clone - Part XLVI - Transcript.pdf
 

More from ankitcom

The most iteresting or surprising fact about microbiology is the exi.pdf
The most iteresting or surprising fact about microbiology is the exi.pdfThe most iteresting or surprising fact about microbiology is the exi.pdf
The most iteresting or surprising fact about microbiology is the exi.pdf
ankitcom
 
System Maintenance         System maintenance is a current action,.pdf
System Maintenance         System maintenance is a current action,.pdfSystem Maintenance         System maintenance is a current action,.pdf
System Maintenance         System maintenance is a current action,.pdf
ankitcom
 
Reverse transcriptase is an enzyme present in some of the virses whi.pdf
Reverse transcriptase is an enzyme present in some of the virses whi.pdfReverse transcriptase is an enzyme present in some of the virses whi.pdf
Reverse transcriptase is an enzyme present in some of the virses whi.pdf
ankitcom
 
Retention factor (Rƒ) is the distance travelled b.pdf
                     Retention factor (Rƒ) is the distance travelled b.pdf                     Retention factor (Rƒ) is the distance travelled b.pdf
Retention factor (Rƒ) is the distance travelled b.pdf
ankitcom
 
In pc engineering, pc design is that the abstract style and elementa.pdf
In pc engineering, pc design is that the abstract style and elementa.pdfIn pc engineering, pc design is that the abstract style and elementa.pdf
In pc engineering, pc design is that the abstract style and elementa.pdf
ankitcom
 
In the year 1900, the maximum number of deaths occurred due to infec.pdf
In the year 1900, the maximum number of deaths occurred due to infec.pdfIn the year 1900, the maximum number of deaths occurred due to infec.pdf
In the year 1900, the maximum number of deaths occurred due to infec.pdf
ankitcom
 
home.htmlStarted!DOCTYPE html html la.pdf
home.htmlStarted!DOCTYPE html html la.pdfhome.htmlStarted!DOCTYPE html html la.pdf
home.htmlStarted!DOCTYPE html html la.pdf
ankitcom
 

More from ankitcom (20)

using the equation P1V1T1 = P2V2T2 we have .pdf
                     using the equation P1V1T1 = P2V2T2  we have  .pdf                     using the equation P1V1T1 = P2V2T2  we have  .pdf
using the equation P1V1T1 = P2V2T2 we have .pdf
 
Yes, theyre right. .pdf
                     Yes, theyre right.                             .pdf                     Yes, theyre right.                             .pdf
Yes, theyre right. .pdf
 
we do not have rights to delete questionsSolutionwe do not hav.pdf
we do not have rights to delete questionsSolutionwe do not hav.pdfwe do not have rights to delete questionsSolutionwe do not hav.pdf
we do not have rights to delete questionsSolutionwe do not hav.pdf
 
The most iteresting or surprising fact about microbiology is the exi.pdf
The most iteresting or surprising fact about microbiology is the exi.pdfThe most iteresting or surprising fact about microbiology is the exi.pdf
The most iteresting or surprising fact about microbiology is the exi.pdf
 
The electrophilic aromatic substitution decreases ifelectron with dr.pdf
The electrophilic aromatic substitution decreases ifelectron with dr.pdfThe electrophilic aromatic substitution decreases ifelectron with dr.pdf
The electrophilic aromatic substitution decreases ifelectron with dr.pdf
 
The buffer solution contains the following species in solutionHCH.pdf
The buffer solution contains the following species in solutionHCH.pdfThe buffer solution contains the following species in solutionHCH.pdf
The buffer solution contains the following species in solutionHCH.pdf
 
That is Distributive propertySolutionThat is Distributive prop.pdf
That is Distributive propertySolutionThat is Distributive prop.pdfThat is Distributive propertySolutionThat is Distributive prop.pdf
That is Distributive propertySolutionThat is Distributive prop.pdf
 
System Maintenance         System maintenance is a current action,.pdf
System Maintenance         System maintenance is a current action,.pdfSystem Maintenance         System maintenance is a current action,.pdf
System Maintenance         System maintenance is a current action,.pdf
 
Sr(OH)2 Solution Sr(OH)2.pdf
                     Sr(OH)2  Solution                     Sr(OH)2.pdf                     Sr(OH)2  Solution                     Sr(OH)2.pdf
Sr(OH)2 Solution Sr(OH)2.pdf
 
sol It says that it absorbs 322 J of heat, there.pdf
                     sol It says that it absorbs 322 J of heat, there.pdf                     sol It says that it absorbs 322 J of heat, there.pdf
sol It says that it absorbs 322 J of heat, there.pdf
 
Reverse transcriptase is an enzyme present in some of the virses whi.pdf
Reverse transcriptase is an enzyme present in some of the virses whi.pdfReverse transcriptase is an enzyme present in some of the virses whi.pdf
Reverse transcriptase is an enzyme present in some of the virses whi.pdf
 
Plug in real numbers for a and b.Since it isnSolutionPlug in.pdf
Plug in real numbers for a and b.Since it isnSolutionPlug in.pdfPlug in real numbers for a and b.Since it isnSolutionPlug in.pdf
Plug in real numbers for a and b.Since it isnSolutionPlug in.pdf
 
momSolutionmom.pdf
momSolutionmom.pdfmomSolutionmom.pdf
momSolutionmom.pdf
 
Retention factor (Rƒ) is the distance travelled b.pdf
                     Retention factor (Rƒ) is the distance travelled b.pdf                     Retention factor (Rƒ) is the distance travelled b.pdf
Retention factor (Rƒ) is the distance travelled b.pdf
 
Java doesnt support multiple inheritance, therefore a class cannot.pdf
Java doesnt support multiple inheritance, therefore a class cannot.pdfJava doesnt support multiple inheritance, therefore a class cannot.pdf
Java doesnt support multiple inheritance, therefore a class cannot.pdf
 
In pc engineering, pc design is that the abstract style and elementa.pdf
In pc engineering, pc design is that the abstract style and elementa.pdfIn pc engineering, pc design is that the abstract style and elementa.pdf
In pc engineering, pc design is that the abstract style and elementa.pdf
 
In the year 1900, the maximum number of deaths occurred due to infec.pdf
In the year 1900, the maximum number of deaths occurred due to infec.pdfIn the year 1900, the maximum number of deaths occurred due to infec.pdf
In the year 1900, the maximum number of deaths occurred due to infec.pdf
 
home.htmlStarted!DOCTYPE html html la.pdf
home.htmlStarted!DOCTYPE html html la.pdfhome.htmlStarted!DOCTYPE html html la.pdf
home.htmlStarted!DOCTYPE html html la.pdf
 
Pb3O4 -- PbO + Pb2O3 hence the mole ratio of le.pdf
                     Pb3O4 -- PbO + Pb2O3  hence the mole ratio of le.pdf                     Pb3O4 -- PbO + Pb2O3  hence the mole ratio of le.pdf
Pb3O4 -- PbO + Pb2O3 hence the mole ratio of le.pdf
 
Lithium Aluminum Hydride is a strong reducing age.pdf
                     Lithium Aluminum Hydride is a strong reducing age.pdf                     Lithium Aluminum Hydride is a strong reducing age.pdf
Lithium Aluminum Hydride is a strong reducing age.pdf
 

Recently uploaded

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 

Recently uploaded (20)

Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 

public class InsufficientFundsException extends Exception{Insuffic.pdf

  • 1. public class InsufficientFundsException extends Exception{ InsufficientFundsException(double balance) { System.out.println("insufficient funds .... available balance : "+balance); } } // Account.java public class Account throws InsufficientFundsException{ private int acctNo; private String owner; private double balance; public Account(){ acctNo = 00; owner = " "; balance= 0.0; } public Account(int ac, String own, double bal){ acctNo = ac; owner = own; balance = bal; } public void Deposit(double amount){ balance = balance + amount; } public void Withdraw (double amount){ try { if(amount>balance) { throw new InsufficientFundsException(balance); } else balance =balance - amount; } catch(InsufficientFundsException e) {
  • 2. System. out.println(e.printStackTrace()); } } public int getAcctNo() { return acctNo; } public void setAcctNo(int ac) { acctNo = ac; } public String getOwner() { return owner; } public void setOwner(String own) { owner = own; } public double getBalance() { return balance; } public void setBalance(double bal) { balance = bal; } public void display(){ System.out.println("Account Number = " + getAcctNo()); System.out.println("Account Owner = " + getOwner()); System.out.println("Account Balance = $" + getBalance()); System.out.println(); } } public class TestExceptions{ public static void main(String args []){ Account a1; a1 = new Account(2222, "Jimmy Zulu", 1000); a1.Deposit(100); a1.display(); Account a2; a2 = new Account();
  • 3. a2.setAcctNo(3333); a2.setOwner("John Mwemba"); a2.setBalance(500); a2.Deposit(100); a2.Withdraw(900); a2.display(); } } Solution public class InsufficientFundsException extends Exception{ InsufficientFundsException(double balance) { System.out.println("insufficient funds .... available balance : "+balance); } } // Account.java public class Account throws InsufficientFundsException{ private int acctNo; private String owner; private double balance; public Account(){ acctNo = 00; owner = " "; balance= 0.0; } public Account(int ac, String own, double bal){ acctNo = ac; owner = own; balance = bal; } public void Deposit(double amount){ balance = balance + amount; } public void Withdraw (double amount){
  • 4. try { if(amount>balance) { throw new InsufficientFundsException(balance); } else balance =balance - amount; } catch(InsufficientFundsException e) { System. out.println(e.printStackTrace()); } } public int getAcctNo() { return acctNo; } public void setAcctNo(int ac) { acctNo = ac; } public String getOwner() { return owner; } public void setOwner(String own) { owner = own; } public double getBalance() { return balance; } public void setBalance(double bal) { balance = bal; } public void display(){ System.out.println("Account Number = " + getAcctNo()); System.out.println("Account Owner = " + getOwner()); System.out.println("Account Balance = $" + getBalance()); System.out.println();
  • 5. } } public class TestExceptions{ public static void main(String args []){ Account a1; a1 = new Account(2222, "Jimmy Zulu", 1000); a1.Deposit(100); a1.display(); Account a2; a2 = new Account(); a2.setAcctNo(3333); a2.setOwner("John Mwemba"); a2.setBalance(500); a2.Deposit(100); a2.Withdraw(900); a2.display(); } }