You are writing a program to determine sales commission, where the following com
ID: 3703503 • Letter: Y
Question
You are writing a program to determine sales commission, where the following commission rates are used:
Write the constant declarations that will be needed in the code when calculating the commission. You can write these as define directives or as constant variables, but in either case, you must use standard and proper syntax.
(This is not asking to write a program or any code that will use these constants. Show only the constant declarations.) Program Language is c++
sales rate < 10,000 3% > 10,000 and <= 15,000 5% > 15,000 7%Explanation / Answer
In the question we have three things which are constant, they are all the three rates for three different sales. Now we can store them in three different constants. So below is the proper syntax for declaration of the three constants by both methods:
1. Using const qualified variables :
const int RATE1 = 3;
const int RATE2 = 5;
const int RATE3 = 7;
2. Using define directives :
#define RATE1 3
#define RATE2 5
#define RATE3 7
It is a better practice to keep the name of constant variables in Capital.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.