Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C# Language Create a console-based application that computes the price of a desk

ID: 3668917 • Letter: C

Question

C# Language

Create a console-based application that computes the price of a desk and whose Main() method calls four other methods:

A method to accept the number of drawers in the desk as input from the keyboard. This method returns the number of drawers to the Main() method.

A method to accept as input and return the type of wood - 'm' for mahogany, 'o' for oak, or 'p' for pine.

A method that accepts the number of drawers 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 method returns the cost to the Main() method. A method to display all the details and the final price.

Explanation / Answer

// Desks.cpp : Defines the entry point for the console application. 02 // Michael Otis - DMACC C++ 03 // Chapter 6, Exercise 7 04    05 #include 06 #include 07    08 using namespace std; 09    10 11 int main() 12 { 13     double woodCost, drawerCost, calc, usersDrawers(), usersWood(), calculations(); 14     char woods; 15         char woodType(); 16    17     drawerCost = usersDrawers(); 18     woodCost = usersWood(); 19     woods = woodType(); 20     calc = calculations(); 21    22     cout