63 140
Assignments Done
99,1%
Successfully Done
In July 2018

Answer to Question #10299 in C++ for tuff elmir

Question #10299
Write a function displayTotalCost prototyped by
void displayTotalCost(double totalCost, unsigned recordNum, bool aborted);
so that the execution of this function will first display the total sale cost stored in variable totalCost and the total number of sale records stored in recordNum. If aborted is true, then the function will also display an error message to the effect "Input terminated by invalid data at record" followed by the corresponding record value. For example, displayTotalCost(55.55, 3, false) could just display
Total sale cost (3 records) = $55.55
while displayTotalCost(66.66, 7, true) could display
Total sale cost (7 records) = $66.66
Input terminated by invalid data at record 8.
Write a driver program to illustrate the use of this function displayTotalCost
Expert's answer
void displayTotalCost(double totalCost, unsigned recordNum, bool aborted){
if (aborted) {
& cout << "Total sale cost (" << recordNum <<" records) = $" << totalCost << endl;
} else
& cout << "Total sale cost (" << recordNum <<" records) = $" << totalCost << " Input terminated by invalid data at record " << recordNum+1 << "." << endl;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions