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: 9.0Create 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:
GiftCard(double amount)- a constructor to initialize the card
void buyBook(double 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.
GiftCard
amount: double
GiftCard(double)
buybook(double): void
amountRemaining(): double
 Your program should work with the following test program, to produce

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!