Question: USE C++ LANGUAGE PLEASE This project will allow you to exercise your knowledge and skills with inheritance and virtual functions. Here's what you need to

USE C++ LANGUAGE PLEASE

This project will allow you to exercise your knowledge and skills with inheritance and virtual functions.

Here's what you need to do:

Create the following classes:

o Product, DomesticProduct, and InternationalProduct

A Product should: o Have a name (string), with accessor o Have a price (double), with accessor o Have a constructor that takes both name and price, setting them accordingly o Have a method called computeTotalPrice() that

Multiples the price by the tax (via getTaxRate()) to determine the new price, which includes the tax

o Have a pure virtual method called getTaxRate() which returns a double

A DomesticProduct should

o Inherit from Product

o Have a stateManufactured attribute (string), with accessor o Implement getTaxRate(), with a rate of 9.75% o Have a constructor takes name, price, stateManufactured as attributes and leverages the

Product constructor

An InternationalProduct o Inherit from Product

o Have a countryManufactured attribute (string), with accessor o Have a currencyRate attribute (double) o Implement getTaxRate(), with a rate of 17.75% o Redefines computeTotalPrice() such that it first multiplies the price with the currency

rate before adding tax o Have a constructor takes name, price, countryManufactured, currencyRate as attributes

and leverages the Product constructor

Your resulting code should compile and execute with the following main:

int main() { DomesticProduct tv("GE Deluxe 57 inch", 219.99, "Kansas"); InternationalProduct car("Toyota Tercel", 211242.68, "Japan", .0088);

cout << tv.getName() << " is made in " << tv.getStateManufactured() << ", $" << tv.computeTotalPrice() << endl;

cout << car.getName() << " is made in " << car.getCountryManufactured() << ", $" << car.computeTotalPrice() << endl; }

When run, this should produce:

 GE Deluxe 57 inch is made in Kansas, $241.439 Toyota Tercel is made in Japan, $2188.9 

USE C++ LANGUAGE PLEASE

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!