Question: Create a class called Account that includes three instance variables: accNo (int), cus- tomer (of the class Customer you have just created, assume that each

 Create a class called Account that includes three instance variables: accNo

Create a class called Account that includes three instance variables: accNo (int), cus- tomer (of the class Customer you have just created, assume that each account has one and only one customer) and balance (double(initialized to 0.0)). The class contains: . Two constructors: +Account(id:int, customer:Customer, balance: double) +Account(id:int, customer:Customer) Provide get methods for each instance variable. Provide set balance method. Provide a method toString takes no arguments and returns "name(id) balance Rs xx.xx" (Balance rounded to 2 decimal places). Provide a method called deposit that deposit money to an Account Add deposit amount to balance). Provide a method called withdraw that withdraws money from an Account. if (balance >= amount) balance = balance - amount else print a message "Withdraw amount exceeded account balance." Write a test program called TestAccount to test the Account class

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!