The goal of this lab is to practice using inheritance in C++.
A skeleton version of the programs will appear in your
cs35/lab/02 directory when you run update35. The
program handin35 will only submit files in this directory. In
later labs you can work with a partner, but for this lab you should
work on your own.
You will write a program that allows a user to repeatedly create new credit cards from three possible types: a standard card, a gold card, or a last chance card.
void useCard(CreditCard *card);Inside this function, you would use card-> to call methods. Do not move on to the next step until your CreditCard class has been fully tested and is working correctly.
Create a credit card 1:Standard 2:Gold 3:Last Chance> 1 First name> Mike Last name> Doughty Account number> 610970 0:End, 1:Card status, 2:Charge it, 3:Make payment> 1 Name: Mike Doughty Number: 610970 Rate: 18.0 Limit: $5000.00 Balance: $0.00 0:End, 1:Card status, 2:Charge it, 3:Make payment> 2 Enter amount to charge> 35.99 Charged 35.99 to account 610970 0:End, 1:Card status, 2:Charge it, 3:Make payment> 2 Enter amount to charge> 100 Charged 100.00 to account 610970 0:End, 1:Card status, 2:Charge it, 3:Make payment> 3 Enter payment amount (Minimum $10.00, Balance $135.99> 120 Payment of $120.00 made to account 610970 Charged $2.04 in interest 0:End, 1:Card status, 2:Charge it, 3:Make payment> 2 Enter amount to charge> 54.40 Charged 54.40 to account 610970 0:End, 1:Card status, 2:Charge it, 3:Make payment> 3 Enter payment amount (Minimum $10.00, Balance $72.43> 72.43 Payment of $72.43 made to account 610970 Balance paid in full 0:End, 1:Card status, 2:Charge it, 3:Make payment> 0 Do you want to create another card (1=yes, 0=no)> 0 GoodbyeHere's how the interaction might continue for a gold card:
Create a credit card 1:Standard 2:Gold 3:Last Chance> 2 First name> Lady Last name> Gaga Account number> 03281986 0:End, 1:Card status, 2:Charge it, 3:Make payment> 2 Enter amount to charge> 25000 Charged 25000.00 to account 03281986 0:End, 1:Card status, 2:Charge it, 3:Make payment> 1 Gold Card --------- Name: Lady Gaga Number: 03281986 Rate: 10.0 Limit: $100000.00 Balance: $25000.00 Points earned: 25000 0:End, 1:Card status, 2:Charge it, 3:Make payment> 3 Enter payment amount (Minimum $416.67, Balance $25000.00> 10 Payment failed 0:End, 1:Card status, 2:Charge it, 3:Make payment> 1 Gold Card --------- Name: Lady Gaga Number: 03281986 Rate: 10.0 Limit: $100000.00 Balance: $25000.00 Points earned: 25000 0:End, 1:Card status, 2:Charge it, 3:Make payment> 3 Enter payment amount (Minimum $416.67, Balance $25000.00> 20000 Payment of $20000.00 made to account 03281986 Charged $208.34 in interest 0:End, 1:Card status, 2:Charge it, 3:Make payment> 1 Gold Card --------- Name: Lady Gaga Number: 03281986 Rate: 10.0 Limit: $100000.00 Balance: $5208.34 Points earned: 25000 0:End, 1:Card status, 2:Charge it, 3:Make payment> 3 Enter payment amount (Minimum $86.81, Balance $5208.34> 5208.34 Payment of $5208.34 made to account 03281986 Balance paid in full 0:End, 1:Card status, 2:Charge it, 3:Make payment> 0 Do you want to create another card (1=yes, 0=no)> 0 GoodbyeAnd finally a LastChanceCard:
Create a credit card 1:Standard 2:Gold 3:Last Chance> 3 First name> Lindsay Last name> Lohan Account number> 07021984 0:End, 1:Card status, 2:Charge it, 3:Make payment> 1 Last Chance Card --------- Name: Lindsay Lohan Number: 07021984 Rate: 25.0 Limit: $1000.00 Balance: $0.00 Consecutive full pays: 0 0:End, 1:Card status, 2:Charge it, 3:Make payment> 2 Enter amount to charge> 2000 Charge failed Current balance $0.00 0:End, 1:Card status, 2:Charge it, 3:Make payment> 2 Enter amount to charge> 25.00 Charged 25.00 to account 07021984 0:End, 1:Card status, 2:Charge it, 3:Make payment> 3 Enter payment amount (Minimum $10.00, Balance $25.00> 25 Payment of $25.00 made to account 07021984 Balance paid in full 0:End, 1:Card status, 2:Charge it, 3:Make payment> 1 Last Chance Card --------- Name: Lindsay Lohan Number: 07021984 Rate: 25.0 Limit: $1000.00 Balance: $0.00 Consecutive full pays: 1 0:End, 1:Card status, 2:Charge it, 3:Make payment> 2 Enter amount to charge> 10 Charged 10.00 to account 07021984 0:End, 1:Card status, 2:Charge it, 3:Make payment> 3 Enter payment amount (Minimum $10.00, Balance $10.00> 10 Payment of $10.00 made to account 07021984 Balance paid in full 0:End, 1:Card status, 2:Charge it, 3:Make payment> 2 Enter amount to charge> 35.00 Charged 35.00 to account 07021984 0:End, 1:Card status, 2:Charge it, 3:Make payment> 2 Enter amount to charge> 25.25 Charged 25.25 to account 07021984 0:End, 1:Card status, 2:Charge it, 3:Make payment> 1 Last Chance Card --------- Name: Lindsay Lohan Number: 07021984 Rate: 25.0 Limit: $1000.00 Balance: $60.25 Consecutive full pays: 2 0:End, 1:Card status, 2:Charge it, 3:Make payment> 3 Enter payment amount (Minimum $10.00, Balance $60.25> 60.25 Payment of $60.25 made to account 07021984 Balance paid in full Congratulations! Because you paid your balanace if full Three consecutive times, we are raising your limit to $1500.00 and lowering your rate to 20.00% 0:End, 1:Card status, 2:Charge it, 3:Make payment> 1 Last Chance Card --------- Name: Lindsay Lohan Number: 07021984 Rate: 20.0 Limit: $1500.00 Balance: $0.00 Consecutive full pays: 3 0:End, 1:Card status, 2:Charge it, 3:Make payment> 2 Enter amount to charge> 20 Charged 20.00 to account 07021984 0:End, 1:Card status, 2:Charge it, 3:Make payment> 3 Enter payment amount (Minimum $10.00, Balance $20.00> 20 Payment of $20.00 made to account 07021984 Balance paid in full 0:End, 1:Card status, 2:Charge it, 3:Make payment> 1 Last Chance Card --------- Name: Lindsay Lohan Number: 07021984 Rate: 20.0 Limit: $1500.00 Balance: $0.00 Consecutive full pays: 4 0:End, 1:Card status, 2:Charge it, 3:Make payment> 2 Enter amount to charge> 200 Charged 200.00 to account 07021984 0:End, 1:Card status, 2:Charge it, 3:Make payment> 3 Enter payment amount (Minimum $10.00, Balance $200.00> 10 Payment of $10.00 made to account 07021984 Charged $3.34 in interest 0:End, 1:Card status, 2:Charge it, 3:Make payment> 1 Last Chance Card --------- Name: Lindsay Lohan Number: 07021984 Rate: 20.0 Limit: $1500.00 Balance: $193.34 Consecutive full pays: 0 0:End, 1:Card status, 2:Charge it, 3:Make payment> 0 Do you want to create another card (1=yes, 0=no)> 0 Goodbye