Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 (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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started