Question

In: Computer Science

Your task is to create a book ordering form using VISUAL STUDIOS, with the code and...

Your task is to create a book ordering form using VISUAL STUDIOS, with the code and screenshots

1. Boxes for first name, last name, address.

2. Radio buttons to select: hard cover, soft cover, ebook.

3. Drop down list to select the book (make up three or four book names).

4. Radio buttons to select credit card (at least Visa, Master Card, American Express).

5. Box to enter credit card numbers.

6. The credit card box MUST verify that numbers are entered only. It will display error information and make the user enter the information agaion.

7. All items will be checked to make sure the user entered something, or selected something. If something is missing an error message must be displayed.

Once the user clicks the submit button, the following happens:

A total price is determined by looking at the book selected, and the type of book selected.

If the book is hardback, the price is $50, softback $40, ebook $30.

Add 10% sales tax.

Display the book name, book type, and total cost back to the user. Also thank them for the order.

Make everything user friendly by including labels, and text to explain what to do and what to enter into boxes.

Solutions

Expert Solution

1. Open Visual studio

2.Open new project -> C# -> Windows Form App (.net framework)

3. Add text boxes and labels for firstname,lastname and address and name the tbxFirstName,tbxLastName and tbxAddr.

4. Add groupbox and add radiobuttons with rBtnHardCover, rBtnSoftCover and rBtnEbook, select checked true in single radio

5. Add Combobox with DropDownStyle to Dropdownlist and add book names in collection items.

6. Radio buttons for credit card same as cover- > visa,master and american express, select checked true in single radio

code for from cs

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

  

private void btnSubmit_Click(object sender, EventArgs e)
{
if( string.IsNullOrEmpty( tbxFirstName.Text.Trim()))
{
MessageBox.Show("Please enter first name");
return;
}
if (string.IsNullOrEmpty(tbxLastName.Text.Trim()))
{
MessageBox.Show("Please enter last name");
return;
}

if (string.IsNullOrEmpty(tbxAddr.Text.Trim()))
{
MessageBox.Show("Please enter address");
return;
}

if (string.IsNullOrEmpty(tbxCardNo.Text.Trim()))
{
MessageBox.Show("Please enter card no");
return;
}
string booktype = rBtnEbook.Text;
Double Price = 30;
if(rBtnHardCover.Checked)
{
Price = 50;
booktype = rBtnHardCover.Text;
}
else if(rBtnSoftCover.Checked)
{
Price = 40;
booktype = rBtnSoftCover.Text;
}

double total = Price + Price * 10 / 100;

MessageBox.Show(@"Thanks for order."+Environment.NewLine+"Order Details"+ Environment.NewLine+
"Book : " +cbxBookName.Text+ Environment.NewLine + "BookType : "+ booktype + Environment.NewLine + "Cost : "+total.ToString("0.00")
);
  


}

private void Form1_Load(object sender, EventArgs e)
{
cbxBookName.SelectedIndex = 0;
}

private void tbxCardNo_KeyPress(object sender, KeyPressEventArgs e)
{
if (!char.IsDigit(e.KeyChar) && e.KeyChar != 8)
e.Handled = true;
}
}
}

Designer:

namespace BookOrderForm
{
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.label1 = new System.Windows.Forms.Label();
this.tbxFirstName = new System.Windows.Forms.TextBox();
this.tbxLastName = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.tbxAddr = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.rBtnHardCover = new System.Windows.Forms.RadioButton();
this.rBtnSoftCover = new System.Windows.Forms.RadioButton();
this.rBtnEbook = new System.Windows.Forms.RadioButton();
this.cbxBookName = new System.Windows.Forms.ComboBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label4 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.rBtnAE = new System.Windows.Forms.RadioButton();
this.rBtnVisa = new System.Windows.Forms.RadioButton();
this.rBtnMaster = new System.Windows.Forms.RadioButton();
this.tbxCardNo = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.btnSubmit = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(57, 27);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(63, 13);
this.label1.TabIndex = 0;
this.label1.Text = "FirstName : ";
//
// tbxFirstName
//
this.tbxFirstName.Location = new System.Drawing.Point(126, 24);
this.tbxFirstName.Name = "tbxFirstName";
this.tbxFirstName.Size = new System.Drawing.Size(149, 20);
this.tbxFirstName.TabIndex = 1;
//
// tbxLastName
//
this.tbxLastName.Location = new System.Drawing.Point(126, 50);
this.tbxLastName.Name = "tbxLastName";
this.tbxLastName.Size = new System.Drawing.Size(149, 20);
this.tbxLastName.TabIndex = 3;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(57, 53);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(64, 13);
this.label2.TabIndex = 2;
this.label2.Text = "Last Name :";
//
// tbxAddr
//
this.tbxAddr.Location = new System.Drawing.Point(126, 76);
this.tbxAddr.Multiline = true;
this.tbxAddr.Name = "tbxAddr";
this.tbxAddr.Size = new System.Drawing.Size(149, 54);
this.tbxAddr.TabIndex = 5;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(57, 79);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(51, 13);
this.label3.TabIndex = 4;
this.label3.Text = "Address :";
//
// rBtnHardCover
//
this.rBtnHardCover.AutoSize = true;
this.rBtnHardCover.Checked = true;
this.rBtnHardCover.Location = new System.Drawing.Point(19, 19);
this.rBtnHardCover.Name = "rBtnHardCover";
this.rBtnHardCover.Size = new System.Drawing.Size(76, 17);
this.rBtnHardCover.TabIndex = 6;
this.rBtnHardCover.TabStop = true;
this.rBtnHardCover.Text = "hard cover";
this.rBtnHardCover.UseVisualStyleBackColor = true;
//
// rBtnSoftCover
//
this.rBtnSoftCover.AutoSize = true;
this.rBtnSoftCover.Location = new System.Drawing.Point(19, 42);
this.rBtnSoftCover.Name = "rBtnSoftCover";
this.rBtnSoftCover.Size = new System.Drawing.Size(72, 17);
this.rBtnSoftCover.TabIndex = 7;
this.rBtnSoftCover.TabStop = true;
this.rBtnSoftCover.Text = "soft cover";
this.rBtnSoftCover.UseVisualStyleBackColor = true;
//
// rBtnEbook
//
this.rBtnEbook.AutoSize = true;
this.rBtnEbook.Location = new System.Drawing.Point(19, 65);
this.rBtnEbook.Name = "rBtnEbook";
this.rBtnEbook.Size = new System.Drawing.Size(55, 17);
this.rBtnEbook.TabIndex = 8;
this.rBtnEbook.TabStop = true;
this.rBtnEbook.Text = "ebook";
this.rBtnEbook.UseVisualStyleBackColor = true;
//
// cbxBookName
//
this.cbxBookName.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbxBookName.FormattingEnabled = true;
this.cbxBookName.Items.AddRange(new object[] {
"Book1",
"Book2",
"Book3"});
this.cbxBookName.Location = new System.Drawing.Point(126, 234);
this.cbxBookName.Name = "cbxBookName";
this.cbxBookName.Size = new System.Drawing.Size(149, 21);
this.cbxBookName.TabIndex = 9;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.rBtnEbook);
this.groupBox1.Controls.Add(this.rBtnHardCover);
this.groupBox1.Controls.Add(this.rBtnSoftCover);
this.groupBox1.Location = new System.Drawing.Point(126, 136);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(149, 92);
this.groupBox1.TabIndex = 13;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Cover type";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(57, 237);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(66, 13);
this.label4.TabIndex = 14;
this.label4.Text = "Book Name:";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.rBtnAE);
this.groupBox2.Controls.Add(this.rBtnVisa);
this.groupBox2.Controls.Add(this.rBtnMaster);
this.groupBox2.Location = new System.Drawing.Point(126, 261);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(149, 92);
this.groupBox2.TabIndex = 15;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Select Credit Card";
//
// rBtnAE
//
this.rBtnAE.AutoSize = true;
this.rBtnAE.Location = new System.Drawing.Point(19, 65);
this.rBtnAE.Name = "rBtnAE";
this.rBtnAE.Size = new System.Drawing.Size(109, 17);
this.rBtnAE.TabIndex = 8;
this.rBtnAE.TabStop = true;
this.rBtnAE.Text = "American Express";
this.rBtnAE.UseVisualStyleBackColor = true;
//
// rBtnVisa
//
this.rBtnVisa.AutoSize = true;
this.rBtnVisa.Checked = true;
this.rBtnVisa.Location = new System.Drawing.Point(19, 19);
this.rBtnVisa.Name = "rBtnVisa";
this.rBtnVisa.Size = new System.Drawing.Size(45, 17);
this.rBtnVisa.TabIndex = 6;
this.rBtnVisa.TabStop = true;
this.rBtnVisa.Text = "Visa";
this.rBtnVisa.UseVisualStyleBackColor = true;
//
// rBtnMaster
//
this.rBtnMaster.AutoSize = true;
this.rBtnMaster.Location = new System.Drawing.Point(19, 42);
this.rBtnMaster.Name = "rBtnMaster";
this.rBtnMaster.Size = new System.Drawing.Size(82, 17);
this.rBtnMaster.TabIndex = 7;
this.rBtnMaster.TabStop = true;
this.rBtnMaster.Text = "Master Card";
this.rBtnMaster.UseVisualStyleBackColor = true;
//
// tbxCardNo
//
this.tbxCardNo.Location = new System.Drawing.Point(126, 359);
this.tbxCardNo.MaxLength = 16;
this.tbxCardNo.Name = "tbxCardNo";
this.tbxCardNo.Size = new System.Drawing.Size(149, 20);
this.tbxCardNo.TabIndex = 17;
this.tbxCardNo.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tbxCardNo_KeyPress);
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(57, 362);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(55, 13);
this.label5.TabIndex = 16;
this.label5.Text = "Card No : ";
//
// btnSubmit
//
this.btnSubmit.Location = new System.Drawing.Point(200, 401);
this.btnSubmit.Name = "btnSubmit";
this.btnSubmit.Size = new System.Drawing.Size(75, 23);
this.btnSubmit.TabIndex = 18;
this.btnSubmit.Text = "Submit";
this.btnSubmit.UseVisualStyleBackColor = true;
this.btnSubmit.Click += new System.EventHandler(this.btnSubmit_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(325, 450);
this.Controls.Add(this.btnSubmit);
this.Controls.Add(this.tbxCardNo);
this.Controls.Add(this.label5);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.label4);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.cbxBookName);
this.Controls.Add(this.tbxAddr);
this.Controls.Add(this.label3);
this.Controls.Add(this.tbxLastName);
this.Controls.Add(this.label2);
this.Controls.Add(this.tbxFirstName);
this.Controls.Add(this.label1);
this.Name = "Form1";
this.Text = "Book Order";
this.Load += new System.EventHandler(this.Form1_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();

}

#endregion

private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox tbxFirstName;
private System.Windows.Forms.TextBox tbxLastName;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox tbxAddr;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.RadioButton rBtnHardCover;
private System.Windows.Forms.RadioButton rBtnSoftCover;
private System.Windows.Forms.RadioButton rBtnEbook;
private System.Windows.Forms.ComboBox cbxBookName;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.RadioButton rBtnAE;
private System.Windows.Forms.RadioButton rBtnVisa;
private System.Windows.Forms.RadioButton rBtnMaster;
private System.Windows.Forms.TextBox tbxCardNo;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Button btnSubmit;
}
}

form:


Related Solutions

I need this code in C++ form using visual studios please: Create a class that simulates...
I need this code in C++ form using visual studios please: Create a class that simulates an alarm clock. In this class you should: •       Store time in hours, minutes, and seconds. Note if time is AM or PM. (Hint: You should have separate private members for the alarm and the clock. Do not forget to have a character variable representing AM or PM.) •       Initialize the clock to a specified time. •       Allow the clock to increment to the...
Code should be written in C++ using Visual Studios Community This requires several classes to interact...
Code should be written in C++ using Visual Studios Community This requires several classes to interact with each other. Two class aggregations are formed. The program will simulate a police officer giving out tickets for parked cars whose meters have expired. You must include both a header file and an implementation file for each class. Car class (include Car.h and Car.cpp) Contains the information about a car. Contains data members for the following String make String model String color String...
C# Programming language!!! Using visual studios if possible!! PrimeHealth Suite You will create an application that...
C# Programming language!!! Using visual studios if possible!! PrimeHealth Suite You will create an application that serves as a healthcare billing management system. This application is a multiform project (Chapter 9) with three buttons. The "All Accounts" button allows the user to see all the account information for each patient which is stored in an array of class type objects (Chapter 9, section 9.4).The "Charge Service" button calls the Debit method which charges the selected service to the patient's account...
Program is to be written in C++ using Visual studios Community You are to design a...
Program is to be written in C++ using Visual studios Community You are to design a system to keep track of either a CD or DVD/Blu-ray collection. The program will only work exclusively with either CDs or DVDs/Blu-rays since some of the data is different. Which item your program will work with will be up to you. Each CD/DVD/Blu-ray in the collection will be represented as a class, so there will be one class that is the CD/DVD/Blu-ray. The CD...
Using Visual Basic 2017, Create a form with two textboxes and one button. A user enters...
Using Visual Basic 2017, Create a form with two textboxes and one button. A user enters the course she is taking in the first text box and then clicks on the button. Then if the user entered "Program Language" in the first text box, the second text box will show "Awesome pick!". If the user entered something else, the text box shows "Ok." Please write the correct code.
Using C# Windows App Form Create a simple calculator using +,-,*,/ Please show code GUI Code...
Using C# Windows App Form Create a simple calculator using +,-,*,/ Please show code GUI Code for calculator menus radio button input text boxes
Create a form using the following HTML elements at a minimum. Style the form in your...
Create a form using the following HTML elements at a minimum. Style the form in your CSS. You do not need to include a form action (i.e. the form doesn't have to do anything - we're designing the front end of the form). textarea textbox input type of "email" select radio button checkbox submit button style at least three elements of your form in your stylesheet, including your submit button Use a comment to delineate the beginning and end of...
Your task is to take the below code, and insert comments (using the “%” symbol) next...
Your task is to take the below code, and insert comments (using the “%” symbol) next to each line of code to make sure that you know what every line does. clc clear close all NMax = 100; partialSum = 0; exactAnswer = pi^2; for k=1:NMax partialSum = partialSum + 6/k^2; percentDiff(k) = abs(partialSum - exactAnswer)/exactAnswer*100; end NVector = [1:NMax]; plot(NVector,percentDiff); xlabel('{{Noob}}'); ylabel('% Difference');
Your task is to take the above code, and insert comments (using the “%” symbol) next...
Your task is to take the above code, and insert comments (using the “%” symbol) next to each line of code to make sure that you know what every line does. close all; clear all; clc; thetaAB = 0; angleIncrement = 0.1; numOfLoops = 360/angleIncrement; thetaABVector = [angleIncrement:angleIncrement:360]; rAB = 5; rBC = 8; for i=1:numOfLoops bothResults = SliderCrankPosn(rAB,rBC,thetaAB); rAC(i) = bothResults(1); thetaBC(i) = bothResults(2); thetaAB = thetaAB+angleIncrement; end subplot(2,1,1) plot(thetaABVector,thetaBC,'Linewidth',3); xlabel('\theta_{AB} [degrees]'); ylabel('\theta_{BC} [degrees]'); xlim([0 360]); ylim([300 400]); grid...
ASSEMBLY X86, using VISUAL STUDIOS 2019 Please follow ALL directions! Write a program that calculates and...
ASSEMBLY X86, using VISUAL STUDIOS 2019 Please follow ALL directions! Write a program that calculates and printout the first 6 Fibonacci numbers.   Fibonacci sequence is described by the following formula: Fib(0) = 0, Fib(1) = 1, Fib(2) = Fib(0)+ Fib(1), Fib(n) = Fib(n-1) + Fib(n-2). (sequence 0 1 1 2 3 5 8 13 21 34 ...) Have your program print out "The first six numbers in the Fibonacci Sequence are". Then the numbers should be neatly printed out, with...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT