Question

VISUAL STUDIO - WINDOWS FORM APP (C#) - PLEASE MAKE SURE TO SHOW ALL CODE & ANSWER/FOLLOW ALL THE QUESTIONS IN THE ASSIGNMENT! . . Your program assignment Write a program name DeskGUI that computes the price of a desk and whose button Click Event calls

Example: Desks DESK DESIGNER Step One How many drawers would you like to have? Step Two What type of wood do you want for you

Desks DESK DESIGNER Step Three Step One How many drawers would you like to have? Step Two What type of wood do you want for y

Desks DESK Designer ner Step Three Thank you for ordering a desk with 4 drawers! Your desk should look something like the ima

0 0
Add a comment Improve this question Transcribed image text
Answer #1

C# Program to compute the price of a desk:

//What to include:

  1. Ask how many drawers to the desk
  2. Type of wood for the desk
  3. Acknowledge or review the cost of desk

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;// function to draw the desk with the description
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DeskGUI
{
public partial class Form1 : Form //declaring class form1 as public
{
public Form1()
{
InitializeComponent();
}
bool bContinue = true;
private void cmdOrder_Click(object sender, EventArgs e)
{
int numberOfDrawers = 0; //initializing //drawer number
string typeOfWood = ""; //type of wood
double cost = 0.0; //cost of desk
bContinue = true;


numberOfDrawers = GetDrawers(); //getting the user input request drawer number
typeOfWood = txtWood.Text; //getting the user input request wood type
  

if (bContinue == true)
{
cost = GetCost(numberOfDrawers,
typeOfWood);
DisplayOrder(numberOfDrawers, typeOfWood, cost); //displays the total order of the user
}
}
private int GetDrawers()
{
int drawers = 0;
drawers =
Convert.ToInt32(txtDrawers.Text);
if (drawers <= 0 || drawers > 5)
{
MessageBox.Show("Drawers must be between 1 and 5"); //Number of drawers between 1 to 5
bContinue = false;
}
return drawers;
}
private string GetWood(string wood)
{
//assigning value to type of wood
string ch;
wood.ToLower();
if (wood == "Mahogany")
ch = "m";
else if (wood == "Oak")
ch = "o";
else if (wood == "Pine")
ch = "p";
else
ch = "null";
{
MessageBox.Show("Wood type is invalid, please enter the correct type of wood.");
bContinue = false;
}
return ch;
}
private double GetCost(int drawers, string wood)
{
//Calculates price
double cost;
if (wood == "p")
cost = 100 + (drawers * 30);
else if (wood == "o")
cost = 140 + (drawers * 30);
else
cost = 180 + (drawers * 30);
return cost;
}
string DisplayOrder(int drawers, string wood, double cost)
{
//display values
string result = "Number of drawers are " + drawers
+ "\nDesk is made up of " + wood
+ "\nCost of the table is $ " + cost;
return result;

}
}
}

Add a comment
Know the answer?
Add Answer to:
VISUAL STUDIO - WINDOWS FORM APP (C#) - PLEASE MAKE SURE TO SHOW ALL CODE &...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • VISUAL STUDIO - WINDOWS FORM APP (C#) - PLEASE MAKE SURE TO SHOW ALL CODE &...

    VISUAL STUDIO - WINDOWS FORM APP (C#) - PLEASE MAKE SURE TO SHOW ALL CODE & ANSWER/FOLLOW ALL THE QUESTIONS IN THE ASSIGNMENT! . . Your program assignment Write a program name DeskGUI that computes the price of a desk and whose button Click Event calls the following methods: • 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 the SelectDesk_Click event. A method...

  • VISUAL STUDIO - WINDOWS FORM APP (C#) - PLEASE MAKE SURE TO SHOW ALL CODE &...

    VISUAL STUDIO - WINDOWS FORM APP (C#) - PLEASE MAKE SURE TO SHOW ALL CODE & ANSWER/FOLLOW ALL THE QUESTIONS IN THE ASSIGNMENT! Planet Info Help When planning this project, review the concept of accessing object properties on another form. Form2.IblMessage.Text = "1122.25" or you can put a string or object instead of numbers You can then create one form for the Planets information and set all the properties before you display the Planet Form For the pictures of the...

  • 109 CASE STUDY Dream Desk Compary Dream Desk Company is a major supplier of office desks for can ...

    109 CASE STUDY Dream Desk Compary Dream Desk Company is a major supplier of office desks for can profit from this market growth if prices can be held in line home and business. The company has been in existence since 1875. Affler serving an apprenticeship as a cabinet maker in the and quick delivery can be promised. Dream Desk operates a 250,000 sq. ft. manufacturing fa- cast, George Dreamer had a violent disagreement with the shop eility in Casa Petite,...

  • Write a C++ program for the instructions below. Please read the instructions carefully and make sure they are followed correctly.   and please put comment with code! Problem:2 1. Class Student Create...

    Write a C++ program for the instructions below. Please read the instructions carefully and make sure they are followed correctly.   and please put comment with code! Problem:2 1. Class Student Create a "Hello C++! I love CS52" Program 10 points Create a program that simply outputs the text Hello C++!I love CS52" when you run it. This can be done by using cout object in the main function. 2. Create a Class and an Object In the same file as...

  • Please write c++ (windows) in simple way and show all the steps with the required output

    please write c++ (windows) in simple way and show all the steps with the required output Write a C++ program that simulates the operation of a simple online banking system The program starts by displaying its main menu as shown in Figure1 splay Account nformatson verity Your credit Card elect vour choice Figure 1 Main menu of the program The menu is composed of the following choices 1. When choice 1 is selected (Display Account information), the program should display...

  • This question is about java program. Please show the output and the detail code and comment.And...

    This question is about java program. Please show the output and the detail code and comment.And the output (the test mthod )must be all the true! Thank you! And the question is contain 7 parts: Question 1 Create a Shape class with the following UML specification: (All the UML "-" means private and "+" means public) +------------------------------------+ | Shape | +------------------------------------+ | - x: double | | - y: double | +------------------------------------+ | + Shape(double x, double y) | |...

  • **** ITS MULTI-PART QUESTION. PLEASE MAKE SURE TO ANSWER THEM ALL. SOLVE IT BY JAVA. ****...

    **** ITS MULTI-PART QUESTION. PLEASE MAKE SURE TO ANSWER THEM ALL. SOLVE IT BY JAVA. **** *** ALSO MAKE SURE IT PASS THE TESTER FILE PLEASE*** Often when we are running a program, it will have a number of configuration options which tweak its behavior while it's running. Allow text completion? Collect anonymous usage data? These are all options our programs may use. We can store these options in an array and pass it to the program. In its simplest...

  • If you’re using Visual Studio Community 2015, as requested, the instructions below should be exact but...

    If you’re using Visual Studio Community 2015, as requested, the instructions below should be exact but minor discrepancies may require you to adjust. If you are attempting this assignment using another version of Visual Studio, you can expect differences in the look, feel, and/or step-by-step instructions below and you’ll have to determine the equivalent actions or operations for your version on your own. INTRODUCTION: In this assignment, you will develop some of the logic for, and then work with, the...

  • Can you please help me with creating this Java Code using the following pseudocode? Make Change C...

    Can you please help me with creating this Java Code using the following pseudocode? Make Change Calculator (100 points + 5 ex.cr.)                                                                                                                                  2019 In this program (closely related to the change calculator done as the prior assignment) you will make “change for a dollar” using the most efficient set of coins possible. In Part A you will give the fewest quarters, dimes, nickels, and pennies possible (i.e., without regard to any ‘limits’ on coin counts), but in Part B you...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT