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: | 398 Weeks Ago, 6 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 -----------acq-----------uis-----------iti-----------on -----------of -----------my -----------sol-----------uti-----------on.-----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- ca-----------tch-----------