ITP 132 Northern Virginia Community College Tax Value C++ Program Project Hey there!! I need your help again. 🙂
1. Suppose a function called tax gets a value subtotal from the main function, multiplies it by a global constant tax rate called RATE, and returns the resulting tax value. All quantities are type double. a. Write the function header. b. Write the return statement in the function body. c. Write the statement in the main program that writes out the tax.
2. An output statement may contain more than one variable identifier. Say a program computes two integer quantities inventoryNumber and numberOrdered. Write a single output statement that prints these two quantities along with appropriate text information.
3. Write a C++ main function that gets a single character from the user and writes out a congratulatory message if the character is a vowel (a, e, i, o, or u), but otherwise writes out a “You lose, better luck next time” message.
4. Write a C++ function that receives an integer argument representing the number of DVDs rented so far this month, and a real number argument representing the sales amount for DVDs sold so far this month. The function asks the user for the number of DVDs rented today and the sales amount for DVDs sold today, and then returns the updated figures to the main function.
5. Write a C++ function that receives three integer arguments and returns the maximum of the three values.
6. Write a C++ function that receives miles driven as a type double argument and gallons of gas used as a type int argument, and returns miles per gallon.
7. Write a C++ program that uses an input function to get the miles driven (type double) and the gallons of gas used (type int), then writes out the miles per gallon.
8. Write a C++ program to balance a checkbook. The program needs to get the initial balance, the amounts of deposits, and the amounts of checks. Allow the user to process as many transactions as desired; use separate functions to handle deposits and checks.
9. Write a C++ program to compute the cost of carpeting three rooms. Make the carpet cost a constant of $8.95 per square yard. Use four separate functions to collect the dimensions of a room in feet, convert feet into yards, compute the area, and compute the cost per room. The main function should use a loop to process each of the three rooms, then add the three costs, and write out the total cost. (Hint: The function to convert feet into yards must be used twice for each room, with two different arguments. Hence, it does not make sense to try to give the parameter the same name as the argument.)
10. What is the output after the following main function is executed? Test your knowledge without running it.
int main()
{
int low, high;
low = 1;
high = 20;
while (low < high)
{
cout << low << “ ” << high << endl;
low = low + 1;
high = high - 1;
}
return 0;
}
11. An array declaration such as int table[5][3]; represents a two-dimensional table of values with 5 rows and 3 columns. Rows and columns are numbered in C++
starting at 0, not at 1. Given this declaration, how do you refer to the marked cell below?
table[4][1];
table[2][0];
12. Given the declaration int list[10];
how do you refer to the eighth number in the array?
13. How many times is the cout statement executed in the following
section of code?
left = 10;
right = 20;
while (left <= right)
{
cout << left << endl;
left = left + 2;
}
14. What is the output from the following section of code?
quotaThisMonth = 7;
quotaLastMonth = quotaThisMonth + 1;
if ((quotaThisMonth > quotaLastMonth)||
(quotaLastMonth >= 8))
{
cout << “Yes”;
quotaLastMonth = quotaLastMonth + 1;
}
else
{
cout << “No”;
quotaThisMonth = quotaThisMonth + 1;
}
15. Assume the variable declarations:
int x = 0;
int *ptr = &x;
Which of the following statements will increment Foo?
1) ptr++;
2) *(x++);
3) (*x)++;
4) (*ptr)++;
5) 1 and 4 only
6) None of these
16. How many elements are allocated for the multiple dimension array:
int four_dimensions[25][86][48][96];
17. What is the number of the last subscript of the following array?
int test[5];
17. What is the output of following program segments?
int x = 10, y;
y = x++;
cout << y;
Show the answer.
int x = 10, y;
y = x++;
cout << x;
Show the answer.
int x = 10;
x++;
cout << x;
Show the answer.
int x = 10, y;
y = ++x;
cout << y;
Show the answer.
int x = 10;
cout << ++x;
Show the answer.
int x = 10;
cout << x++;
Show the answer.
8. What is the output of following program?
int x = 10,y;
y = x + x++;
cout << y;
Show the answer.
int x = 10,y;
y = ++x + x++ + x;
cout << y;
Show the answer.
int x = 10, y;
y = x++ + x + ++x;
cout << y;
Show the answer.
Consider the following information, and answer the question below. China and England are international trade…
The CPA is involved in many aspects of accounting and business. Let's discuss some other…
For your initial post, share your earliest memory of a laser. Compare and contrast your…
2. The Ajax Co. just decided to save $1,500 a month for the next five…
How to make an insertion sort to sort an array of c strings using the…
Assume the following Keynesian income-expenditure two-sector model:                                               AD = Cp + Ip                                               Cp = Co…