Answer to Question #264026 in C# for Emely

Question #264026

Create an application that receives an internet application from a company’s prospective customers. The following information must be received from the applicant: - Name - Internet Choice - Applicant salary In the event that the “Check application” button is clicked, the complete application result must be displayed in the listbox control of a second form. The label control of the second form must simply indicate whether an application is “approved” or “not approved” If a user has a salary of R2500 or less, then the application cannot be approved, else the application will be approved. 


1
Expert's answer
2021-11-10T09:42:44-0500
namespace InternetApplication
{
    partial class frmInternetApplication
    {
        /// <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.label1 = new System.Windows.Forms.Label();
            this.txtName = new System.Windows.Forms.TextBox();
            this.label2 = new System.Windows.Forms.Label();
            this.txtSalary = new System.Windows.Forms.TextBox();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.rbUSBDongle = new System.Windows.Forms.RadioButton();
            this.rbLTEWiFi = new System.Windows.Forms.RadioButton();
            this.rbFibre = new System.Windows.Forms.RadioButton();
            this.btnCheckApplication = new System.Windows.Forms.Button();
            this.groupBox1.SuspendLayout();
            this.SuspendLayout();
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(20, 33);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(38, 13);
            this.label1.TabIndex = 0;
            this.label1.Text = "Name:";
            // 
            // txtName
            // 
            this.txtName.Location = new System.Drawing.Point(81, 30);
            this.txtName.Name = "txtName";
            this.txtName.Size = new System.Drawing.Size(100, 20);
            this.txtName.TabIndex = 1;
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(20, 59);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(39, 13);
            this.label2.TabIndex = 0;
            this.label2.Text = "Salary:";
            // 
            // txtSalary
            // 
            this.txtSalary.Location = new System.Drawing.Point(81, 56);
            this.txtSalary.Name = "txtSalary";
            this.txtSalary.Size = new System.Drawing.Size(100, 20);
            this.txtSalary.TabIndex = 2;
            // 
            // groupBox1
            // 
            this.groupBox1.Controls.Add(this.rbFibre);
            this.groupBox1.Controls.Add(this.rbLTEWiFi);
            this.groupBox1.Controls.Add(this.rbUSBDongle);
            this.groupBox1.Location = new System.Drawing.Point(196, 20);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(164, 100);
            this.groupBox1.TabIndex = 3;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "Internet choice";
            // 
            // rbUSBDongle
            // 
            this.rbUSBDongle.AutoSize = true;
            this.rbUSBDongle.Checked = true;
            this.rbUSBDongle.Location = new System.Drawing.Point(22, 32);
            this.rbUSBDongle.Name = "rbUSBDongle";
            this.rbUSBDongle.Size = new System.Drawing.Size(84, 17);
            this.rbUSBDongle.TabIndex = 0;
            this.rbUSBDongle.TabStop = true;
            this.rbUSBDongle.Text = "USB Dongle";
            this.rbUSBDongle.UseVisualStyleBackColor = true;
            // 
            // rbLTEWiFi
            // 
            this.rbLTEWiFi.AutoSize = true;
            this.rbLTEWiFi.Location = new System.Drawing.Point(22, 55);
            this.rbLTEWiFi.Name = "rbLTEWiFi";
            this.rbLTEWiFi.Size = new System.Drawing.Size(77, 17);
            this.rbLTEWiFi.TabIndex = 0;
            this.rbLTEWiFi.Text = "LTE / WiFi";
            this.rbLTEWiFi.UseVisualStyleBackColor = true;
            // 
            // rbFibre
            // 
            this.rbFibre.AutoSize = true;
            this.rbFibre.Location = new System.Drawing.Point(22, 78);
            this.rbFibre.Name = "rbFibre";
            this.rbFibre.Size = new System.Drawing.Size(48, 17);
            this.rbFibre.TabIndex = 0;
            this.rbFibre.Text = "Fibre";
            this.rbFibre.UseVisualStyleBackColor = true;
            // 
            // btnCheckApplication
            // 
            this.btnCheckApplication.Location = new System.Drawing.Point(23, 93);
            this.btnCheckApplication.Name = "btnCheckApplication";
            this.btnCheckApplication.Size = new System.Drawing.Size(158, 23);
            this.btnCheckApplication.TabIndex = 4;
            this.btnCheckApplication.Text = "Check application";
            this.btnCheckApplication.UseVisualStyleBackColor = true;
            this.btnCheckApplication.Click += new System.EventHandler(this.btnCheckApplication_Click);
            // 
            // frmInternetApplication
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(379, 142);
            this.Controls.Add(this.btnCheckApplication);
            this.Controls.Add(this.groupBox1);
            this.Controls.Add(this.txtSalary);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.txtName);
            this.Controls.Add(this.label1);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.Name = "frmInternetApplication";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "Internet application";
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.TextBox txtName;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.TextBox txtSalary;
        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.RadioButton rbFibre;
        private System.Windows.Forms.RadioButton rbLTEWiFi;
        private System.Windows.Forms.RadioButton rbUSBDongle;
        private System.Windows.Forms.Button btnCheckApplication;
    }
}





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 InternetApplication
{
    public partial class frmInternetApplication : Form
    {
        public frmInternetApplication()
        {
            InitializeComponent();
        }


        private void btnCheckApplication_Click(object sender, EventArgs e)
        {
            bool approved = false;
            double salary;
            double.TryParse(txtSalary.Text,out salary);


            string selectedInternet = "USB Dongle";
            if (rbLTEWiFi.Checked) {
                selectedInternet = "LTE / WiFi";
            }
            if (rbFibre.Checked)
            {
                selectedInternet = "Fibre";
            }


            if (salary > 2500) {
                approved = true;
            }
            frmResultForm frm_ResultForm = new frmResultForm(approved, txtName.Text, salary, selectedInternet);
            frm_ResultForm.ShowDialog();
        }
    }
}





namespace InternetApplication
{
    partial class frmResultForm
    {
        /// <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.lblApproved = new System.Windows.Forms.Label();
            this.lstResult = new System.Windows.Forms.ListBox();
            this.SuspendLayout();
            // 
            // lblApproved
            // 
            this.lblApproved.AutoSize = true;
            this.lblApproved.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.lblApproved.Location = new System.Drawing.Point(6, 9);
            this.lblApproved.Name = "lblApproved";
            this.lblApproved.Size = new System.Drawing.Size(92, 31);
            this.lblApproved.TabIndex = 0;
            this.lblApproved.Text = "label1";
            // 
            // lstResult
            // 
            this.lstResult.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.lstResult.FormattingEnabled = true;
            this.lstResult.ItemHeight = 25;
            this.lstResult.Location = new System.Drawing.Point(21, 62);
            this.lstResult.Name = "lstResult";
            this.lstResult.Size = new System.Drawing.Size(372, 129);
            this.lstResult.TabIndex = 1;
            // 
            // frmResultForm
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(415, 206);
            this.Controls.Add(this.lstResult);
            this.Controls.Add(this.lblApproved);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.Name = "frmResultForm";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "Result form";
            this.Load += new System.EventHandler(this.frmResultForm_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label lblApproved;
        private System.Windows.Forms.ListBox lstResult;
    }
}





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 InternetApplication
{
    public partial class frmResultForm : Form
    {
        
        public frmResultForm(bool approved,string name,double salary,string selectedInternet)
        {
            InitializeComponent();


            if (approved)
            {
                lblApproved.Text = "Application is approved";
            }
            else {
                lblApproved.Text = "Application is NOT approved";
            }
            lstResult.Items.Add("Name: " + name);
            lstResult.Items.Add("Salary: R" + salary.ToString("N2"));
            lstResult.Items.Add("Internet: " + selectedInternet);
        }


        private void frmResultForm_Load(object sender, EventArgs e)
        {


        }
    }
}





Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS