Question

In: Computer Science

C++ Fill in the blanks please You are required to fill in the blanks in this...

C++ Fill in the blanks please

You are required to fill in the blanks in this program. Consider that: -In main, the variables price and quantity were given the names of p (double) and q (int), respectively. -In the getData function, the parameters associated with the main variables p and q were called pp and pq, respectively.

// Prototype: Do not include the names // of the variables in the prototype

void getData (FILLTHEBLANK , FILLTHEBLANK);

int main ()
{
double p; // p = price of the item
int q; // q = number of articles
double total;

// Call of the function getData - complete
// Remember that p and q want to pass as redeference,
// pointers mode.

getData (FILLTHEBLANK , FILLTHEBLANK);

// Complete the formula that multiplies price and quantity.

total = FILLINTHEBLANK * FILLINTHEBLANK;

cout << "Total to pay =" << total << "\ n \ n";

return 0;

}

// Heading of the function - fill in the data type of the parameters. Note that the parameter names must be pp and pq.

void getData (FILLTHEBLANK, FILLTHEBLANK)

{
cout << "Enter the price of the item:";
cin >> FILLTHEBLANK;

// This is where the price validation would go. Code not included.

cout << "Enter the number of items purchased:";

cin >> FILLTHEBLANK;

// This is where the quantity validation would go. Code no included. }

Solutions

Expert Solution

#include <iostream>
using namespace std;
// Prototype: Do not include the names // of the variables in the prototype

void getData (double& , int&);

int main ()
{
double p; // p = price of the item
int q; // q = number of articles
double total;

// Call of the function getData - complete
// Remember that p and q want to pass as redeference,
// pointers mode.

getData (p, q);

// Complete the formula that multiplies price and quantity.

total = p * q;

cout << "Total to pay =" << total << "\n\n";

return 0;

}

// Heading of the function - fill in the data type of the parameters. Note that the parameter names must be pp and pq.

void getData (double &price, int &quantity)

{
cout << "Enter the price of the item:";
cin >> price;

// This is where the price validation would go. Code not included.

cout << "Enter the number of items purchased:";

cin >> quantity;

// This is where the quantity validation would go. Code no included.
}

Output:

Enter the price of the item:34.12 Enter the number of items purchased: 5 Total to pay =170.6

Do ask if any doubt. Please up-vote.


Related Solutions

14.6 A- Fill in the Blanks for the required C instructions, and also fill in the...
14.6 A- Fill in the Blanks for the required C instructions, and also fill in the missing comments /******************************************************************* This program outputs 30 kHz square wave on port T, bit-0 using timer channel 0 interrupts and the output compare bit operations. *******************************************************************/ #include <mc9s12c32.h> /* derivative information */ #define HALF_P 133 /* Number clocks per 1/2 period */ /******************************************************************/ void interrupt 8 OC0_isr (void); /******************************************************************/ void main(void) {    /******************************************************************/       /* Initialize I/O */             ___________________ = 1;...
please fill in the blanks using c program or lunix with the answers being highlighted 1....
please fill in the blanks using c program or lunix with the answers being highlighted 1. You will now need four files. These are telnos, telnos2, telnos3, telnos4. These files are all short files that contain names, departments, and telephone numbers. This is what they look like. telnos telnos2 Hale Elizabeth Bot   744-6892 Harris Thomas Stat 744-7623 Davis Paulette Phys 744-9579 Cross Joseph   MS    744-0320 Holland Tod    A&S   744-8368 Hale Elizabeth Bot   744-6892 Harris Thomas Stat 744-7623 Davis Paulette Phys...
Please fill in the blanks (values of A, B, C, D, E, F, G, H, I...
Please fill in the blanks (values of A, B, C, D, E, F, G, H, I , J) for the following financial statements. The firm’s tax rate is 35.3%. Income Statement for Fiscal Year 2015 Sales 2,000 Cost of goods sold 1,500 Gross margin 500 Selling and general expenses 300 Operating income 200 Interest income 5 205 Interest expense 21 Restructuring charges 14 Income before tax 170 Income tax 60 Net income J Balance Sheet, Year 2014 and Year 2015...
using Linux please fill in the blanks : telnos files:
  using Linux please fill in the blanks : telnos files: telnos telnos2 Hale Elizabeth Bot   744-6892Harris Thomas Stat 744-7623Davis Paulette Phys 744-9579Cross Joseph   MS    744-0320Holland Tod    A&S   744-8368 Hale Elizabeth Bot   744-6892Harris Thomas Stat 744-7623Davis Paulette Phys 744-9579Holland Tod    A&S   744-8368 telnos3 telnos 4 Hale Elizabeth Bot   744-6892Harris Thomas Stat 744-7623Smith John     Comsc 744-4444Davis Paulette Phys 744-9579Cross Joseph   MS    744-0320Holland Tod    A&S   744-8368 Hale Elizabeth Bot   744-6892Smith John     Comsc 744-4444Davis Paulette Phys 744-9579Cross Joseph   MS    744-0320Holland Tod    A&S   744-8368...
Please fill in the blanks: __________________ - Liabilities = Owner’s Equity. Please express the equation for...
Please fill in the blanks: __________________ - Liabilities = Owner’s Equity. Please express the equation for the Income Statement: ____________________ - ________________ = Net Income. Please express the equation for the Statement of Retained Earnings: BB + or - ______________________ - Dividends +or- = _____________________. Please express the equation for the Balance Sheet: ________________________ = ____________________________ + _________________________. What are the three types of cash flows listed in the Statement of Cash Flows? _________________________, __________________________, _________________________. What are the four...
Fill in the blanks: Consider the following equilibrium and fill in the blanks with either increase...
Fill in the blanks: Consider the following equilibrium and fill in the blanks with either increase or decrease. I2(s) + 5F2(g) ⇌ 2IF5(g) A decrease in volume results in a Blank 1 in pressure which will Blank 2 the amount of IF5.
This question contains multiple fill in the blanks. Please choose from the following words to fill...
This question contains multiple fill in the blanks. Please choose from the following words to fill in the appropriate blanks: mitosis, identical, synapsis, separation, different, meiosis. Words may be used more than once or not at all. NOTE: Enter your answers in all lower case letters exactly as they are shown above. During (a)____, chromosome number is reduced to haploid complements. This is achieved by (b)_____ of homologous chromosomes and their subsequent (c)_____. It would seem to be more mechanically...
Fill in the blanks to make the following statements correct. Please note that you can simply...
Fill in the blanks to make the following statements correct. Please note that you can simply write the words in your assignment response. The shut-down price is the price at which the firm can just cover its                   . If the average variable cost of producing any given level of output exceeds the price at which it can be sold, then the firm should                   . If a firm is producing a level of output such that MC > MR, that firm should                    output. The...
Please fill in the blanks in the following table:          Present                Future        &n
Please fill in the blanks in the following table:          Present                Future                   Interest                   Time to          Value                   Value                      Rate                     Maturity          $20,000                                                6%                      34 years                                    $200,000                    7%                      12 years          $55,000          $111,419.91                                             18 years          $90,000          $207,408.40                 11%                           
fill in the blanks please a) Already outstanding securities are traded in the ______________markets. b) An...
fill in the blanks please a) Already outstanding securities are traded in the ______________markets. b) An IPO is a ____________________ market transaction. c) Firms raise capital by selling newly issued securities in the ___________markets. d) New York Stock exchange is an example of a ____________________ market. e) The ___________ of the securities traded differentiates the money market from the capital market. f) The primary goal of a financial manager should be ___________________ g) Markets for short-term debt securities are called...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT