Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

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

Sams Teach Yourself Beginning Databases In 24 Hours

Authors: Ryan Stephens, Ron Plew

1st Edition

067232492X, 978-0672324925

More Books

Students also viewed these Databases questions