Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Thank you! You have been hired by Wally Wall's Wallet World to create a set of C++ classes for their new electronic wallet device. For
Thank you!
You have been hired by Wally Wall's Wallet World to create a set of C++ classes for their new electronic wallet device. For the first phase, you are to write a C++ class named Wallet. Wally Wall expects that you will eventually be deriving other classes from your Wallet class, so you should design it appropriately. Here is what you know about the Wallet class: When a Wallet object is constructed, the user must provide a double representing the initial number of dollars in the wallet. (If the amount specified is negative, treat it as 0.) All wallets allow the user to determine whether the wallet has any money in it with an isEmpty() method. This method should return a bool that is true iff the amount of money in the wallet is zero. No derived class will ever determine the emptiness of the wallet in a different manner. All wallets have a deposit() method. This method allows the user to add more dollars to the wallet. It accepts a double parameter and adds that number of dollars to the amount already in the wallet. (If the amount is negative, treat it as 0.) The amount in a wallet can be determined by a value() method. This method takes no arguments and returns a double, the number of dollars currently in the wallet. (Notice there's no way to get your money out of the wallet. That's for Release 2.0...) Using your best style, write the class definition and method implementations for your Wallet. Be sure to use public, private, and const appropriately. Your answer must not contain the word protected. (You may continue onto the next page.)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