Question
In this problem, you will input the two-character abbreviation for a Canadian province or territory and a sales amount. You will then calculate the appropriate
In this problem, you will input the two-character abbreviation for a Canadian province or territory and a sales amount. You will then calculate the appropriate sales tax for that location.
In Canada, sales tax varies between provinces and territories. Some have a separate provincial sales tax (PST) and a federal sales tax (GST), while others have a harmonized sales tax (HST), which combines both.
The following sales tax table shows information from the Retail Council of Canada:
Table A: List of provinces and territories with taxes and abbreviations
Province/Territory | Abbrev. | PST | GST | HST |
---|---|---|---|---|
Alberta | AB | 5% | ||
British Columbia | BC | 7% | 5% | |
Manitoba | MB | 7% | 5% | |
New Brunswick | NB | 15% | ||
Newfoundland and Labrador | NL | 15% | ||
Northwest Territories | NT | 15% | ||
Nova Scotia | NS | 15% | ||
Nunavut | NU | 5% | ||
Ontario | ON | 13% | ||
Prince Edward Island | PE | 15% | ||
Quebec | QC | 9.975% | 5% | |
Saskatchewan | SK | 6% | 5% | |
Yukon | YT | 5% |
Input:
The program must receive two lines of input:
Input the 2-character code (string) for the province or territory in which the sale was made and store it to a variable called provAbbrev. This will be the internationally approved alphabetic code found in the Abbrev column in the table in the introduction.
Input the sales amount (float) and store it to a variable called salesAmount.
Processing:
For this problem:
Assume the program will receive a valid province/territory code.
The code may be in uppercase, lowercase, or a mixture of the two. Your program must take this into account.
Calculate the PST, GST, and HST for the sales amount based on the province or territory in which the sale took place.
Store PST, GST, and HST to variables called PST, GST, and HST respectively.
If one of the taxes is not used in this province or territory, make sure it is set to 0.0.
Hint
This problem will require multiple branches/paths through the program.
OUTPUT:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started