1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Lilit [14]
3 years ago
13

A method to accept the number of drawers in the desk as input from the key board. This method returns the number of drawers to t

he SelectDesk_Click event.  A method to accept an 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 o Pine desks are $100 o Oak desks are $140 o All other woods are $180 o A $30 surcharge is added for each drawer. o This method returns the cost to the SelectDesk_Clic
Computers and Technology
1 answer:
Julli [10]3 years ago
5 0

Answer:

Following code takes the information about the wood from the user, do the process of calculating the value according to there type and numbers, then add the surcharge to it while giving the answer to the user.

For differentiating the type of woof i used the if then else statement while i used switch case statement for assigning the appropriate value according to the types of the wood will be processing in the program.

The code is given below:

Explanation:

Code:

namespace std;\\ any name instead of std.

{

   class Program

   { \\ starting the main program

       static void Main(string[ ] args)

       {

           int numberOfDrawers = 0;

           string deskWoodType = "o";

           double cost = 0;

           drawersMeth(numberOfDrawers);

           woodTypeMeth(deskWoodType);

           CalculateCostMeth(numberOfDrawers, cost, deskWoodType);

           OutPutCostMeth(deskWoodType , cost, numberOfDrawers);

       }//end main

       private static void drawersMeth(int numberOfDrawers)

       {

           int numOfDrawers;

           Console.WriteLine("Enter the number of desk drawers");

           numOfDrawers = Convert.ToInt16(Console.ReadLine());

           numberOfDrawers = numOfDrawers;

       }//end drawersMeth

       private static string woodTypeMeth(string deskWoodType)

       {

           Console.WriteLine("Enter the desk wood type. (eg. type mahogany, oak, or pine)");

           deskWoodType = Convert.ToString(Console.ReadLine());

           switch (deskWoodType)

           {

               case "mahogany":

                   {

                       deskWoodType = "m";

                       break;

                   }

               case "oak":

                   {

                       deskWoodType = "o";

                       break;

                   }

               case "pine":

                   {

                       deskWoodType = "p";

                       break;

                   }

               default:

                   {

                       deskWoodType = "error";

                       break;

                   }

           }

           return deskWoodType;

       }// end woodTypeMeth

       private static int CalculateCostMeth(string deskWoodType, int numberOfDrawers, int cost)

       {

           int pine = 100;

           int oak = 140;

           int other = 180;

           int surchage = 30;

           if (deskWoodType == "p")

               cost = surchage + (numberOfDrawers *pine );

           else if (deskWoodType == "o")

               cost = surchage + (numberOfDrawers *oak );

           else

               cost = surchage + (numberOfDrawers *other );

           return cost;

       }// end CalculateCostMeth

       private static void OutPutCostMeth(int numberOfDrawers, string deskWoodType, int cost)

       {

           double totalCost = cost;

           Console.WriteLine("The number of drawers is {0}", numberOfDrawers);

           Console.WriteLine("The wood finish you have selected is ", deskWoodType);

           Console.WriteLine("The total cost is {0}", totalCost);

       }//end outputCost

   }//end class

}//end nameSpace

You might be interested in
How do the following improve security <br> User Id <br> Password<br> Encryption
natima [27]
I would say password.
5 0
3 years ago
Read 2 more answers
Levi wants to run 5 commands sequentially, but does not want to create a shell script. He knows that each command is going to ta
sergeinik [125]

Answer:

um

Explanation:

what subject is this again?

3 0
2 years ago
Insert a row above the selected row
anastassius [24]
I cants see the "Selected Road" And I cant answer this unless you put that up. Sorry.
6 0
3 years ago
Read 2 more answers
Which of the following statements is true?
Lilit [14]

Answer:

Option A is the correct answer choice for the above question.

Explanation:

The computer system needs intercommunication which is done inside the processor to process the task given by the user. There are two types of model is used for intercommunication--

  1. Message passing and
  2. Shared memory

The difference between two is that message passing passes the message on two points at a single unit of time whereas shared memory simultaneous shares the multiple messages. That's why shared memory is faster than message passing.

  • Hence option A is the correct choice because it also refers to the above concept. While the other is not correct because--
  • Option B states that message passing is faster than shared memory which is wrong.  
  • Option C states that message passing is used for large data but shared memory is used for large data.
  • Option D states that shared memory is unavailable in some processor which is wrong.
3 0
3 years ago
What is the difference, if any, between a project manager and a producer on a digital media production team? A project manager o
Flauer [41]

Answer:

A project manager just oversees the creative element, while a producer oversees the entire project.

It is B

7 0
2 years ago
Other questions:
  • What function does the ALU perform?
    10·1 answer
  • PLEASE HELPP!! WILL MARK BRAINLIEST!!~~~~~
    11·1 answer
  • What is an enterprise system
    14·2 answers
  • A computer hard disk starts from rest, then speeds up with an angular acceleration of 190 rad/s2 until it reaches its final angu
    10·2 answers
  • Consider the following high-level recursive procedure: long long int flong long int n, long long int k long long int b b k+2; if
    9·1 answer
  • What is one major difference between the roles of film directors and theater directors? A. A theater director is involved in sel
    14·1 answer
  • What is the difference between "What I ought to do?" and "What kind of person should I be"?
    12·1 answer
  • In computer science how can you define "copyright, designs and patents act 1988"?​
    8·1 answer
  • Write a 5 – 7+ sentence paragraph about Thanksgiving that DOES NOT use the letter “t.”
    10·1 answer
  • Which storage device is not recommended as a permanent storage solution?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!