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 callsExample: Desks DESK DESIGNER Step One How many drawers would you like to have? Step Two What type of wood do you want for youDesks DESK DESIGNER Step Three Step One How many drawers would you like to have? Step Two What type of wood do you want for yDesks 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

Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace DeskGUI
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }


        private void btnSubmit_Click(object sender, EventArgs e)
        {

        
          
            DeskCost();
        }
          

        public int NumOfDrawers()
        {
            string drawers;
            int drawerInt;

  
            drawers = (this.textBox1.Text);
            drawerInt = Convert.ToInt32(drawers);
            return drawerInt;
          


        }

        public string PickWoodType()
        {
          
            string woodType;
          
         

          
            woodType = (this.textBox2.Text);

          
            switch (woodType)
            {
                case "p":
                    woodType = "Pine";
                    break;
                case "o":
                    woodType = "Oak";
                    break;
                case "m":
                    woodType = "Mahogany";
                    break;
                default:
                    woodType = ("Invalid");
                    break;
            }


            return woodType;


        }

        public void DeskCost()
        {
            string wood = PickWoodType();
            double woodCost;


            switch (wood)
            {
                case "Pine":
                    woodCost = 100.00;
                    break;
                case "Oak":
                    woodCost = 140.00;
                    break;
                case "Mahogany":
                    woodCost = 180.00;
                    break;
                default:
                    woodCost = 0.00;
                    break;
                  
            }
      
          
            this.label2.Text = "Wood Chosen: " + wood;
            this.label6.Text = "Wood Cost: " + woodCost;

          
            double deskPrice;
            double totalDrawerCost;
            const double drawerBase = 30.00;
            int drawerTotal;

            drawerTotal = (NumOfDrawers());
            totalDrawerCost = (drawerTotal * drawerBase);
            this.label4.Text = "Drawer Cost : " + totalDrawerCost.ToString("C");
          
            deskPrice = (totalDrawerCost + woodCost);
          
            this.label5.Text = "Total Cost: " + deskPrice.ToString("C");

         

        }

    

     
    }
}


      
Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace DeskGUI
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }
}

Form1.Designer.cs
namespace DeskGUI
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.btnSubmit = new System.Windows.Forms.Button();
            this.lblDrawerNum = new System.Windows.Forms.Label();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.textBox2 = new System.Windows.Forms.TextBox();
            this.lblWoodType = new System.Windows.Forms.Label();
            this.lblWood2 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.label5 = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.label6 = new System.Windows.Forms.Label();
            this.SuspendLayout();
            //
            // btnSubmit
            //
            this.btnSubmit.Location = new System.Drawing.Point(57, 200);
            this.btnSubmit.Name = "btnSubmit";
            this.btnSubmit.Size = new System.Drawing.Size(101, 50);
            this.btnSubmit.TabIndex = 0;
            this.btnSubmit.Text = "Submit Order";
            this.btnSubmit.UseVisualStyleBackColor = true;
            this.btnSubmit.Click += new System.EventHandler(this.btnSubmit_Click);
            //
            // lblDrawerNum
            //
            this.lblDrawerNum.AutoSize = true;
            this.lblDrawerNum.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.lblDrawerNum.Location = new System.Drawing.Point(44, 26);
            this.lblDrawerNum.Name = "lblDrawerNum";
            this.lblDrawerNum.Size = new System.Drawing.Size(216, 20);
            this.lblDrawerNum.TabIndex = 1;
            this.lblDrawerNum.Text = "Enter the Number of Drawers";
            //
            // textBox1
            //
            this.textBox1.Location = new System.Drawing.Point(47, 53);
            this.textBox1.Name = "textBox1";
            this.textBox1.Size = new System.Drawing.Size(126, 20);
            this.textBox1.TabIndex = 2;
            //
            // textBox2
            //
            this.textBox2.Location = new System.Drawing.Point(47, 140);
            this.textBox2.Name = "textBox2";
            this.textBox2.Size = new System.Drawing.Size(126, 20);
            this.textBox2.TabIndex = 3;
            //
            // lblWoodType
            //
            this.lblWoodType.AutoSize = true;
            this.lblWoodType.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.lblWoodType.Location = new System.Drawing.Point(43, 89);
            this.lblWoodType.Name = "lblWoodType";
            this.lblWoodType.Size = new System.Drawing.Size(163, 20);
            this.lblWoodType.TabIndex = 4;
            this.lblWoodType.Text = "Enter the Wood Type:";
            //
            // lblWood2
            //
            this.lblWood2.AutoSize = true;
            this.lblWood2.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.lblWood2.Location = new System.Drawing.Point(12, 109);
            this.lblWood2.Name = "lblWood2";
            this.lblWood2.Size = new System.Drawing.Size(218, 18);
            this.lblWood2.TabIndex = 5;
            this.lblWood2.Text = "o = oak, p = pine, m=mahogany";
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label2.Location = new System.Drawing.Point(341, 77);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(0, 20);
            this.label2.TabIndex = 7;
            //
            // label3
            //
            this.label3.AutoSize = true;
            this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label3.Location = new System.Drawing.Point(338, 26);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(213, 31);
            this.label3.TabIndex = 8;
            this.label3.Text = "Order Summary:";
            //
            // label4
            //
            this.label4.AutoSize = true;
            this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label4.Location = new System.Drawing.Point(341, 138);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(0, 20);
            this.label4.TabIndex = 9;
            //
            // label5
            //
            this.label5.AutoSize = true;
            this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label5.Location = new System.Drawing.Point(341, 190);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(0, 20);
            this.label5.TabIndex = 10;
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(341, 159);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(187, 13);
            this.label1.TabIndex = 11;
            this.label1.Text = "______________________________";
            //
            // label6
            //
            this.label6.AutoSize = true;
            this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label6.Location = new System.Drawing.Point(341, 107);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(0, 20);
            this.label6.TabIndex = 12;
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(673, 413);
            this.Controls.Add(this.label6);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.label5);
            this.Controls.Add(this.label4);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.lblWood2);
            this.Controls.Add(this.lblWoodType);
            this.Controls.Add(this.textBox2);
            this.Controls.Add(this.textBox1);
            this.Controls.Add(this.lblDrawerNum);
            this.Controls.Add(this.btnSubmit);
            this.Name = "Form1";
            this.Text = "Form1";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Button btnSubmit;
        private System.Windows.Forms.Label lblDrawerNum;
        private System.Windows.Forms.TextBox textBox1;
        private System.Windows.Forms.TextBox textBox2;
        private System.Windows.Forms.Label lblWoodType;
        private System.Windows.Forms.Label lblWood2;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.Label label5;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label6;
    }
}

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