Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Step 2 : Write a class Once you have identified the object that is instantiated in the code sample, write the corresponding class for that

Step 2: Write a class
Once you have identified the object that is instantiated in the code sample, write the corresponding class for that object. Think about the things this class would need to have for each line of the code sample to run. Include all necessary attributes and methods to support the functionality demonstrated in the
main method. Within ygur class, ensure that users can't purchase an item larger than the amount in their account, and that only positive values are added to a gift card. You do not need to include exception handling in your answer, unless you want to.
Sample OutputInitial Accounts:Name: Tom Jerry, Balance: $300.00Name: Sally Field, Balance: $150.00Purchase successful for 50.0Insufficient funds for purchase of $200.0 Gift card of $100.75 added successfully
Accounts After Transactions:
Name: Tom Jerry, Balance: $350.75
Name: Sally Field, Balance: $150.00
Purchase successful for 25.5
Gift card of $25.5 added successfully
Transfer $25.5 from Tom to Sally
Final Accounts:
Name: Tom Jerry, Balance: $325.25
Name: Sally Field, Balance: $175.50
Process finished with exit code 0
image text in transcribed

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_2

Step: 3

blur-text-image_3

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

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions

Question

Discuss cultural competence.

Answered: 1 week ago