WORKSHOP SELECTOR The following shows a training company\'s workshops, the numbe
ID: 3586801 • Letter: W
Question
WORKSHOP SELECTOR
The following shows a training company's workshops, the number of days of each, and their registration fees.
Workshop
Handling Stress, 3 days, $1000 fee
Time Management, 3 days, $800 fee
Supervision Skills, 3 days, $1,500 fee
Negotiation, 5 days, $1,300 fee
How to Interview, 1 day, $500 fee
The training company conducts its workshops in the six locations shown in the following table. The table also shows the lodging fees per day at each location.
Location
Austin - $150 per day
Chicago - $225 per day
Dallas - $175 per day
Orlando - $300 per day
Phoenix - $175 per day
Raleigh - $150 per day
When a customer registers for a workshop, he or she must pay the registration fee plus the lodging fees for the selected location. For example, here are the charges to attend the Supervision Skills workshop in Orlando:
Registration: $1,500
Lodging: $300 x 3 days = $900
Total: $2,400
Create an application that lets the user select a workshop from one ListBox and a location from another ListBox. When the user clicks a button, the application should calculate and display the registration cost, the lodging cost, and the total cost.
Explanation / Answer
https://drive.google.com/drive/folders/0B0OYG722iR76OHFQM256YnhQenc?usp=sharing
complete source code available in above location.
you will be required visual studion to open the solution..
----- class file
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
DataTable dtLocation = new DataTable();
DataTable dtWorkshop = new DataTable();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
BindData();
}
void BindData()
{
dtWorkshop.Clear();
dtWorkshop.Columns.Add("WorkshopName");
dtWorkshop.Columns.Add("Days");
dtWorkshop.Columns.Add("Fee");
dtWorkshop.Rows.Add(new object[] { "Handling Stress", 3, 100 });
dtWorkshop.Rows.Add(new object[] { "Time Management", 3, 800 });
dtWorkshop.Rows.Add(new object[] { "Supervision Skills", 3, 1500 });
dtWorkshop.Rows.Add(new object[] { "Negotiation", 5, 1300 });
dtWorkshop.Rows.Add(new object[] { "How to Interview", 1, 500 });
dtLocation.Clear();
dtLocation.Columns.Add("LocationName");
dtLocation.Columns.Add("Fee");
dtLocation.Rows.Add(new object[] { "Austin", 150 });
dtLocation.Rows.Add(new object[] { "Chicago", 225 });
dtLocation.Rows.Add(new object[] { "Dallas", 175 });
dtLocation.Rows.Add(new object[] { "Orlando", 300 });
dtLocation.Rows.Add(new object[] { "Phoenix", 175 });
dtLocation.Rows.Add(new object[] { "Raleigh ", 150 });
cmbLocation.DataSource = dtLocation;
cmbLocation.DisplayMember = "LocationName";
cmbWorkShopName.DataSource = dtWorkshop;
cmbWorkShopName.DisplayMember = "WorkshopName";
}
private void btnSubmit_Click(object sender, EventArgs e)
{
CalculateAmt();
}
void CalculateAmt()
{
DataRow[] drLocation = dtLocation.Select("LocationName = '" + cmbLocation.Text + "'");
int LodgAmt = Convert.ToInt32(drLocation[0][1]);
DataRow[] drWorkShopName = dtWorkshop.Select("WorkshopName = '" + cmbWorkShopName.Text + "'");
int drDuration = Convert.ToInt32(drWorkShopName[0][1]);
int fee = Convert.ToInt32(drWorkShopName[0][2]);
int TotalAmt = fee + (LodgAmt * drDuration);
lblDetails.Text = "Total Amount : $ "+ TotalAmt.ToString();
}
private void cmbWorkShopName_SelectionChangeCommitted(object sender, EventArgs e)
{
}
}
}
-------------------------------------- designer
namespace WindowsFormsApp1
{
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.lblDetails = new System.Windows.Forms.Label();
this.btnSubmit = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.cmbLocation = new System.Windows.Forms.ComboBox();
this.cmbWorkShopName = new System.Windows.Forms.ComboBox();
this.SuspendLayout();
//
// lblDetails
//
this.lblDetails.AutoSize = true;
this.lblDetails.Location = new System.Drawing.Point(227, 187);
this.lblDetails.Name = "lblDetails";
this.lblDetails.Size = new System.Drawing.Size(0, 13);
this.lblDetails.TabIndex = 11;
//
// btnSubmit
//
this.btnSubmit.Location = new System.Drawing.Point(401, 135);
this.btnSubmit.Name = "btnSubmit";
this.btnSubmit.Size = new System.Drawing.Size(75, 23);
this.btnSubmit.TabIndex = 10;
this.btnSubmit.Text = "Submit";
this.btnSubmit.UseVisualStyleBackColor = true;
this.btnSubmit.Click += new System.EventHandler(this.btnSubmit_Click);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(227, 111);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(57, 13);
this.label2.TabIndex = 9;
this.label2.Text = "Location : ";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(188, 84);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(96, 13);
this.label1.TabIndex = 8;
this.label1.Text = "Workshop Name : ";
//
// cmbLocation
//
this.cmbLocation.FormattingEnabled = true;
this.cmbLocation.Location = new System.Drawing.Point(296, 108);
this.cmbLocation.Name = "cmbLocation";
this.cmbLocation.Size = new System.Drawing.Size(180, 21);
this.cmbLocation.TabIndex = 7;
//
// cmbWorkShopName
//
this.cmbWorkShopName.FormattingEnabled = true;
this.cmbWorkShopName.Location = new System.Drawing.Point(296, 81);
this.cmbWorkShopName.Name = "cmbWorkShopName";
this.cmbWorkShopName.Size = new System.Drawing.Size(180, 21);
this.cmbWorkShopName.TabIndex = 6;
this.cmbWorkShopName.SelectionChangeCommitted += new System.EventHandler(this.cmbWorkShopName_SelectionChangeCommitted);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(739, 428);
this.Controls.Add(this.lblDetails);
this.Controls.Add(this.btnSubmit);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.cmbLocation);
this.Controls.Add(this.cmbWorkShopName);
this.Name = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label lblDetails;
private System.Windows.Forms.Button btnSubmit;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox cmbLocation;
private System.Windows.Forms.ComboBox cmbWorkShopName;
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.