Modify the CreditCard class from Code Fragment 1.3 to check that the price argument passed to function
Question:
Modify the CreditCard class from Code Fragment 1.3 to check that the price argument passed to function charge It and the payment argument passed to function make Payment are positive.
Data from in Fragment 1.3
The file CreditCard.cpp, which contains the definition of the out-of-class member functions for class CreditCard.
Transcribed Image Text:
#include
#include
#include "Credit Card.h"
// provides STL vector
// provides Credit Card, cout, string
// make std accessible
// Credit Card test function
// vector of 10 Credit Card pointers
// allocate 3 new cards
wallet [0] = new Credit Card ("5391 0375 9387 5309", "John Bowman", 2500);
wallet [1] = new Credit Card ("3485 0399 3395 1954", "John Bowman", 3500);
wallet [2] = new Credit Card ("6011 4902 3294 2994", "John Bowman", 5000);
using namespace std;
void test Card() {
vector wallet (10);
for (int j=1; j <= 16; j++) {
wallet [0]->chargelt (double(j));
wallet [1]->chargelt(2* j);
wallet [2]->chargelt (double (3 * j));
}
// make some charges
// explicitly cast to double
// implicitly cast to double
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 75% (12 reviews)
The CreditCard class from Code Fragment 13 should be modified to check that the price argument pa...View the full answer
Answered By
Tamondong Riza
Professionally, I am a teacher with years of experience tutoring math and science, as well as teaching in both public schools and independent schools. I feel that education should be an enlightening experience for all children, and I'm committed to helping my students learn new skills and make progress in their subjects.
0.00
0 Reviews
10+ Question Solved
Related Book For
Data Structures And Algorithms In C++
ISBN: 9780470383278
2nd Edition
Authors: Michael T. Goodrich, Roberto Tamassia, David M. Mount
Question Posted:
Students also viewed these Computer science questions
-
Modify the CreditCard class from Code Fragment 1.5 so that printSummary becomes a nonstaticmethod, and modify the mainmethod fromCode Fragment 1.6 accordingly.
-
Modify the CreditCard class from Code Fragment 1.2 to include modifier functions that allow a user to modify internal variables in a CreditCard class in a controlled manner. Data from in Fragment 1.2...
-
Modify the CreditCard class from Code Fragment 1.2 to charge interest on each payment. Data from in Fragment 1.2 A typical C++ program includes many different header files, which often include other...
-
Question 1 As at 31 December x5 the statement of financial position of Span and Cat was as follows: Ordinary shares of RM10 each Ordinary shares of RM1 each 7% preference shares of RM1 each 5.6%...
-
Some company managers forbid employees from using the Internet for non-work-related activities. What are the implications for e-marketers that segment their markets using the variable of home and...
-
In Figure particle 1 of charge + 4e is above a floor by distance d1 = 2.00 mm and particle 2 of charge + 6e is on the floor, at distance d2 = 6.00 mm horizontally from particle 1. What is the -r...
-
An F-test with 12 degrees of freedom in the numerator and 6 degrees of freedom in the denominator produced a test statistic whose value was 3.42. The null and alternate hypotheses were H0: 1 = 2...
-
Moe Green estimates the cost of future projects for a large contracting firm. Mr. Green uses precisely the same techniques to estimate the costs of every potential job, and formulates bids by adding...
-
Intel Corporation. You may recall that this crisis was based around the Pentium chip error. A math Professor at Lynchburg College (Virginia) noticed that his Pentium-based computer was making...
-
1. Would you classify Bill Gates as a charismatic or transformational leader? Why? 2. Consider the followers/employees of Gates. What are some of the unique characteristics of Gatess followers that...
-
Modify the CreditCard class from Code Fragment 1.2 to charge a late fee for any payment that is past its due date. Data from in Fragment 1.2 A typical C++ program includes many different header...
-
Write a C++ class, Flower, that has three member variables of type string, int, and float, which respectively represent the name of the flower, its number of pedals, and price. Your class must...
-
In the liquefaction process, why are gases compressed to very high pressures?
-
A $1,000 par value bond is currently valued at $1,050. The bond pays interest semi-annually, has 9 years to maturity, and has a yield to maturity of 7.72 percent. What is the coupon rate and the...
-
On April 1, Jiro Nozomi created a new travel agency, Adventure Travel. The following transactions occurred during the company's first month. April 2 Nozomi invested $37,000 cash and computer...
-
The current price of a non-dividend-paying stock is $40. Over the next year it is expected to rise to $42 or fall to $37. An investor buys one-year put options with a strike price of $41. Which...
-
explain why the pink ball has more momentum even though it's moving slower than the green ball?
-
What is the price of a European put option on a non-dividend-paying stock when the stock price is $99, the strike price is $101, the continuously compounded risk-free rate is 2% per annum, the...
-
Use the method of Problem 34 to find the terms through x4 in the series for sech x?
-
What is the shape of the exponential distribution?
-
Give a recursive algorithmto compute the product of two positive integers, m and n, using only addition and subtraction.
-
Develop a nonrecursive implementation of the version of the power method from Code Fragment 5.9 that uses repeated squaring. 1 /** Computes the value of x raised to the nth power, for nonnegative...
-
Describe a recursive algorithm for converting a string of digits into the integer it represents. For example, '13531' represents the integer 13,531.
-
Sunland Company sells product 2 0 0 5 WSC for $ 7 0 per unit and uses the LIFO method. The cost of one unit of 2 0 0 5 WSC is $ 6 7 , and the replacement cost is $ 6 6 . The estimated cost to dispose...
-
Susan Wilson is opening a small flower shop that will focus primarily on delivery, though it will provide a small showroom for walk-in customers. A local florist is retiring and selling her small...
-
On January 1, 2019, Alsvin Company enters into a lease of equipment with Benni Company with a lease term of four years. The lease is properly accounted for as an operating lease. The rate Benni...
Study smarter with the SolutionInn App