The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 408 Weeks Ago, 3 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
Rewrite the Desks program from Exercise 7, passing all variables as reference variables and changing all the function return types to void. Save the file as Desks2.cpp.
Â
Exercise 7:
Â
Write a program that calculates the cost of building a desk. The main()function calls four other functions. Pass all variables so that the functions make copies of any variables they receive:
Â
» A function to accept as input from the keyboard the number of drawers in the desk. This function returns the number of drawers to the main program.
Â
» A function to accept as input the type of wood—‘m’ for mahogany, ‘o’ for oak, or ‘p’ for pine.
Â
» A function that receives the drawer number and wood type, and calculates the cost of the desk based on the following:
Â
Pine desks are $100.
Â
Oak desks are $140.
Â
All other woods are $180.
Â
A $30 surcharge is added for each drawer.
Â
This function returns the cost to the main()function.
» A function to display the final price. Save the file as Desks.cpp
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll