Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Main Function: int main() { CashPayment cp1(75.25); CashPayment cp2(36.95); CreditCardPayment ccp1(95.15, Smith, 12/21/2009, 321654987); CreditCardPayment ccp2(45.75, James, 10/30/2008, 963852741); cout cp1.paymentDetails(); cout cp2.paymentDetails(); cout ccp1.paymentDetails();

image text in transcribed

Main Function:

int main()

{

CashPayment cp1(75.25);

CashPayment cp2(36.95);

CreditCardPayment ccp1(95.15, "Smith", "12/21/2009", "321654987");

CreditCardPayment ccp2(45.75, "James", "10/30/2008", "963852741");

cout

cp1.paymentDetails();

cout

cp2.paymentDetails();

cout

ccp1.paymentDetails();

cout

ccp2.paymentDetails();

return 0;

}

Language is C++

You are required to implement following classes: Payment Class Define a class named Payment that contains: o a member variable of type double that stores the amount of the payment and appropriate accessor and mutator methods. o a method named paymentDetails() that outputs an English sentence that describes the amount of the payment. Cash Payment Class Define a class named CashPayment that is derived from Payment. This class should redefine the paymentDetails() method to indicate that the payment is in cash. Include appropriate constructor(s). Credit Card Payment Class Define a class named CreditCardPayment that is derived from Payment. This class should contain member variables for the name on the card, expiration date, and credit card number. Include appropriate constructor(s). Redefine the paymentDetails() method to include all credit card information in the printout. A main function should work as required

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_2

Step: 3

blur-text-image_3

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 Design And SQL For DB2

Authors: James Cooper

1st Edition

1583473572, 978-1583473573

More Books

Students also viewed these Databases questions