Question: 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
