Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C+++ Programming!! In C++ please! Problem 1: Write code that uses polymorphism to make printing out similar objects using their appro- priate attributes. The program

C+++ Programming!! In C++ please!

image text in transcribed

image text in transcribed

Problem 1: Write code that uses polymorphism to make printing out similar objects using their appro- priate attributes. The program will prompt the user to input as many cards as desired, including driver license, passports, library cards, university ID cards, bank cards, and credit cards. It will then print all the cards in ascending order of expiration date, such that the cards that expire the soonest are printed first, and those without expiration date are printed last. To do this, consider all cards belong to three main categories: basic cards, ID cards, and bank cards. Basic cards only contain the name of the institution, the name of the person, and sometimes an expiration date. ID cards such as your driver license or passport number can also contain an ID number and date of birth (DOB). Bank cards contain an account number and a card security code number. Create a base class Card as well as derived classes IDCard and BankCard with data fields as explained above. Write any necessary member functions and non-member functions such that your program prompts the user to input as many cards as desired and then prints them all in order of expiration date. Follow the format shown in the output sample exactly and abide by good coding practices. Figure 1 shows a sample output. * Wallet Printer! * Print Cards by selecting the type (when done) : 1. Basic Card 2. ID Card 3. Bank Card Card Type : 3 | LIBRARY CARD name : Andrew Tzuo exp : 03/28/2017 Institution name : BANK OF AMERICA Card holder name : Jane Baker Expiration date mmddyyy @ if none) : 08282023 Account number : 3456478310001 Card Security Code : 353 | CHASE name : Jane Baker exp : 03/25/2022 Card Type : 1 | Account# : 907929020294 CSC : 749 Institution name : UCLA Card holder name : Andrew Tzuo Expiration date nimddyyy (@ if none) : 0 Card Type : 2 | BANK OF AMERICA name : Jane Baker exp : 08/28/2823 Institution name : UCLA BRUIN CARD Card holder name : Ashley Phillips Expiration date mmddyyy (@ if none) : 0 ID number : 352573968 DOB mmddyyy (0 if not listed) : 0 | Account# : 3456478310001 T CSC : 353 Card Type : 1 UCLA name : Andrew Tzuo exp : N/A. Institution name : LIBRARY CARD Card holder name : Andrew Tzuo Expiration date nmddyyy (@if none) : 03282017 Card Type : 3 | UCLA BRUIN CARD name : Ashley Phillips exp : N/A. Institution name : CHASE Card holder name : Jane Baker Expiration date amddyyy (@ if none) : 03252022 Account number : 987929020294 Card Security Code : 749 ID# : 352573968 DOB : N/A

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

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions