Question: questions 3 what is the purpose of the setdata method...
3. What is the purpose of the setData method? -
4. What is the purpose of the getIncreasedPrice method?
5. What is the purpose of the code on Lines 36 and 37?
6. What statement is missing from Line 69?
7. Line 74 should display the increased price. What code is missing from that line?
8. Enter the missing statement and code from Steps 6 and 7. Save and then run the program. Enter ABX-12 as the computer ID, 2500 as the price, and 0.1 as the increase rate. The program displays the message “The new price of computer ABX-12 is $2750.00.” Now, enter PYZ-43 as the computer ID, 1900 as the price, and 10 as the increase rate. The program displays the message “The new price of computer PYZ-43 is $2090.00.”
9. Test the program using different computer IDs, prices, and rates. When you are finished testing the program, enter the letter x as the computer ID.
//Lab4 displays an increased price
using namespace std;
void setData(string, double);
id = "";
price = 0.0;
} //end of default constructor
void Item::setData(string idNum, double p)
id = idNum;
price = p;
} //end of setData method
double Item::getIncreasedPrice(double rate)
if (rate > 1.0)
rate /= 100;
return price + price * rate;
} //end of getIncreasedPrice method
//instantiate an Item object
string computerId = "";
double computerPrice = 0.0;
double incRate = 0.0;
cout << fixed << setprecision(2);
//get computer ID
cout << "Computer ID (X to end): ";
while (computerId != "X" && computerId != "x")
//get price and increase rate
cout << "Enter the price: ";
cin >> computerPrice;
cout << "Increase rate in decimal form : ";
cin >> incRate;
//assign the ID and price
//display the increased price
cout << "The new price of computer "
<< computerId << " is $"
//get computer ID
cout << endl << "Computer ID (X to end): ";
} //end while
} //end of main function