Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Your program should work with the following test program, to produce the expected output shown below. Expected Output: Books bought successfully Books bought successfully Not
Your program should work with the following test program, to produce the expected output shown below.
Expected Output:
Books bought successfully
Books bought successfully
Not enough money in the card
Remaining balance: Create a class GiftCard that represents a gift card for the purchase of books online. It should have the following private
attribute:
amount the amount of money on the card
and the following public methods:
GiftCarddouble amount a constructor to initialize the card
void buyBookdouble totalPrice records the purchase of books by decreasing the amount of money used for purchase
using this card and prints "Books bought successfully". Print an error message if the gift card does not have sufficient
amount to pay the totalPrice.
double amountRemaining returns the remaining amount of money in the gift card.
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