Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java Code:- Part A Include an equals method in both the CreditCard and DebitCard classes to compare two objects. Part B- Wallet class

Write a Java Code:-

image text in transcribed

image text in transcribed

Part A Include an equals method in both the CreditCard and DebitCard classes to compare two objects. Part B- Wallet class Write a class called Wallet to store information about the current state of a wallet. A wallet has different compartments for the dollar bills, loose change, credit/ debit cards and ID cards. Data Members should include: . Amount of cash keep track of value of dollar bills and value of change separately .Array of ChargeCards it can contain both CreditCards and DebitCards. . Array of ID cards this can be simply an array of Strings, I's ap to you how to store this information. Methods should include: . at least two constructors . accessor, mutator methods TotalCashOnHand total value of dollar bills and change TotalCanSpend-includes both cash and mount that can be spent on credit / debit cards. * a method that tells you how many ID Cards are in the wallet a method that tells you how many credit/ debit cards are in the wallet .a method that lets you add a credit /debit card to the set . a method to append an ID card to the set . toString method should delegate to CreditCard class to print information about each credit card and DebitCard class to print information about each debit card. Remember to keep the design paradigms of data hiding and encapsulation in mind as much as possible. Delegate tasks to the component classes (of ChargeCard, DebiCard, CredinCard) whenever you can Perform inpt validation as appropriate. Part C- Menu Driven Program Write a menu-driven program that allows the user to interact with a single Wallet object. . Print all information about Wallet. IThis should call the toString method of the Wallet class.] 2. Add a Credit Card. Prompt the user for information about the Credit Card] 3. Add a Debit Card. [Prompt the user for information about the Debit Card.] 4. Add an ID Card. Prompt the user for information about the ID card.] 5. Add Cash. [Prompt the user for the value of additional coins or dollar bills.] 6. Make a purchase. Should ask for purchase amount. Then let the user choose whether to pay with cash or charge card. If cash, make sure there is sufficient cash in the wallet to cover the purchase, and then deduct accordingly. If chage card, there should be a submenu in which the user chooses a card from the list to use. Then the system should check that the card can be used for that purchase, i.e., that there are sufficient funds available on that card, and actually process the purchase on the selected ChargeCard.]

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

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions